GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 1.22

Matching algorithm costs

Algorithms · Searching, Sorting & Selection · Full GATE CSE 1998 paper

GATE 1998, Q1.22 1 mark · MCQ
Report issue

Searching, Sorting & Selection

Question 1.22, GATE 1998: Match log n, n, n log n, n² to binary search, selection, merge sort, insertion sort.
Tap to enlarge
Your answer
Answer & solution

Answer: B: 3, 1, 4, 2 (no official key was published)

Binary search halves a sorted interval each step, giving logarithmic search time. Selection of a specified rank can be done in linear worst-case time using median-of-medians. Merge sort has logarithmically many levels with linear work per level, giving n log n. Insertion sort can shift a quadratic number of elements on reverse-sorted input. Therefore the intended mapping is 3, 1, 4, 2, B. “Selection” means order-statistic selection, not selection sort, whose worst-case comparisons are quadratic.

Original paper, page 2