An O(n lg n)
algorithm for the longest increasing subsequence problem. This algorithm is based on patience sorting. The algorithm reads n
, the length of the sequence, then it reads n
space separated values. The output is then written on the screen. The programs then prompts the user for another value of n
and so on.