GATE CS 2011 · Question 25 · Algorithms · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

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 Lᵢ denote the length of the longest monotonically increasing sequence starting at index i in the array.
Initialize Lₙ₋₁ = 1.
For all i such that 0 ≤ i ≤ n-2
Lᵢ = 1 + Lᵢ₊₁ if A[i] < A[i+1] ; 1 Otherwise
Finally the length of the longest monotonically increasing sequence is Max(L₀, L₁, …, Lₙ₋₁).
Which of the following statements is TRUE ?

  1. (A) The algorithm uses dynamic programming paradigm
  2. (B) The algorithm has a linear complexity and uses branch and bound paradigm
  3. (C) The algorithm has a non-linear polynomial complexity and uses branch and bound paradigm
  4. (D) The algorithm uses divide and conquer paradigm.
Answer

Answer (A)

Answer from the official GATE CS 2011 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes