Given a sequence S=(x0,x1, . . . ,xn−1) of numbers, describe an O(n2)-time algorithm for finding a longest subsequence T = (xi0 ,xi1 , . . . ,xik−1) of numbers, such that i j < i j+1 and xi j > xi j+1 . That is, T is a longest decreasing subsequence of S.
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.