Question 80Asked in DSSSB PGT Computer Science (Technical), 11 Jul 2021

Two way merge sort algorithm is used to sort the following elements in ascending order.

Two way merge sort algorithm is used to sort the following elements in ascending order. 200, 470, 150, 80, 90, 40, 400, 300, 120, 70. What is the order of these elements after second pass of the merge sort algorithm?
  1. A40, 70, 80, 90, 120, 150, 200, 300, 400, 470
  2. B200, 470, 80, 150, 40, 90, 300, 400, 70, 120
  3. C80, 150, 200, 470, 40, 90, 300, 400, 70, 120
  4. D40, 80, 90, 150, 200, 300, 400, 470, 70, 120
Show answerHide answer

Correct answer: (C) 80, 150, 200, 470, 40, 90, 300, 400, 70, 120

Explanation

Pass 1 merges pairs: (200,470)(80,150)(40,90)(300,400)(70,120). Pass 2 merges runs of two into fours: 80,150,200,470 | 40,90,300,400 | 70,120.

From DSSSB PGT Computer Science PYQ (Technical), 11 Jul 2021

This is question 80 of DSSSB PGT Computer Science PYQ (Technical), 11 Jul 2021. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.