ISRO Computer Science (CSE) 2015 - Question 42

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2015

If one uses straight two-way merge sort algorithm to sort the following elements in ascending order: 20, 47, 15, 8, 9, 4, 40, 30, 12, 17. Then the order of these elements after second pass of the algorithm is

  • A. 8, 9, 15, 20, 47, 4, 12, 7, 30, 40
  • B. 8, 15, 20, 47, 4, 9, 30, 40, 12, 17
  • C. 15, 20, 47, 4, 8, 9, 12, 30, 40, 17
  • D. 4, 8, 9, 15, 20, 47, 12, 17, 30, 40

Answer: B. 8, 15, 20, 47, 4, 9, 30, 40, 12, 17

Explanation: Pass 1 (groups of 2): (20,47), (8,15), (4,9), (30,40), (12,17). Pass 2 (groups of 4): (8,15,20,47), (4,9,30,40), (12,17).

| | All questions of ISRO Computer Science (CSE) 2015