GATE Computer ScienceVery hardGATE CSE · UGC NET
In how many ways can a longest strictly increasing subsequence be chosen (counting index sets, not distinct value sequences) from the array [3, 1, 2, 5, 4, 6, 3, 7, 5, 8]?
- A. 0
- B. 2
- C. 4
- D. 6
Correct answer: B. 2
The LIS length is 6; DP with counts per ending index (confirmed by brute force) gives 2 index sets.
More Algorithms questions
- Randomised quicksort picks the pivot uniformly at random from the current sub-array and each partition of m elements uses exactly m−1…
- Bellman–Ford from source 0 on vertices 0..5 relaxes the directed edges (u→v, w) in this fixed order in every pass: 4→5 (1), 3→4 (1), 2→3…
- The recurrence T(n) = 2T(n/2) + n/log₂ n (with T(1) = 1) has the solution
- Top-down merge sort (split at ⌊n/2⌋, standard merge that stops comparing once one list is exhausted) sorts [38, 27, 43, 3, 9, 82, 10, 15…
- A DFS is run on a directed graph with adjacency lists 0:[1,4], 1:[2,5], 2:[0,3], 3:[1], 4:[5,6], 5:[3], 6:[4,5], 7:[3,6]. Vertices are…
- In how many different ORDERED sequences of coins from {1, 4, 5} can a total of exactly 15 be formed (sequences like 1,4 and 4,1 count…