GATE Computer ScienceEasyGATE CS (PYQ pattern)

A = [2, 5, 9, 14, 20, 27, 35, 41] and B = [1, 6, 8, 15, 22, 30, 33, 45, 50] are sorted. What is the 10th smallest element of the union of the two arrays?

  1. A. 20
  2. B. 27
  3. C. 30
  4. D. 22

Correct answer: D. 22

The merged order begins 1, 2, 5, 6, 8, 9, 14, 15, 20, 22, so the 10th smallest is 22. A binary search on the partition finds it in O(log n) without merging.

More Algorithms questions

Exams that ask this topic