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:
$8, \ 9, \ 15, \ 20, \ 47, \ 4, \ 12, \ 17, \ 30, \ 40$
$8, \ 15, \ 20, \ 47, \ 4, \ 9, \ 30, \ 40, \ 12, \ 17$
$15, \ 20, \ 47, \ 4, \ 8, \ 9, \ 12, \ 30, \ 40, \ 17$
$4, \ 8, \ 9, \ 15, \ 20, \ 47, \ 12, \ 17, \ 30, \ 40$
Hi Guys,
Notice the word Two-Way merge sort. It could be N-ways also.
$20$ $47$ $15$ $8$ $9$ $4$ $40$ $30$ $12$ $17$ \ / \ / \ / \ / \ / $20$ $47$ $8$ $15$ $4$ $9$ $30$ $40$ $12$ $17$ after $1$st pass \ / \ / \ / \ / \ / \ / $8,15,20,47$ $4,9, 30,40$ $12,17$ after $2$nd pass
Ans. B
sir, not seen the solution to this particular question but, asking if this is possible for this question. http://www.geeksforgeeks.org/merge-sort/ - here they are using top-down approach (see the numbering of operations -depth first left first, very different from here used in answer) https://en.wikipedia.org/wiki/Merge_sort#Top-down_implementation - Wikipedia
Gatecse