GATE Computer Science (CS) 2011 Solved Paper

© examsiri.com
Question : 35 of 65
 
Marks: +1, -0
An algorithm to find the length of the longest monotonically increasing sequence of numbers in an array A[0 : n - 1] is given below.
Let Li denote the length of the longest monotonically increasing sequence starting at index i in the array.
Initialize Ln-1 = 1
For all i such that 0 â‰¤ i â‰¤ n - 2
Li={1+Li+1if A[i]<A[i+1] 1otherwise.
Finally the length of the longest monotonically increasing sequence is Max (L0, L1, ... Ln-1).
Which of the following statements is TRUE?
Go to Question: