edited by
33,401 views
67 67 votes

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:

  1. $8, \ 9, \ 15, \ 20, \ 47, \ 4, \ 12, \ 17, \ 30, \ 40$

  2. $8, \ 15, \ 20, \ 47, \ 4, \ 9, \ 30, \ 40, \ 12, \ 17$

  3. $15, \ 20, \ 47, \ 4, \ 8, \ 9, \ 12, \ 30, \ 40, \ 17$

  4. $4, \ 8, \ 9, \ 15, \ 20, \ 47, \ 12, \ 17, \ 30, \ 40$

3 Answers

Best answer
154 154 votes

The answer is B.

edited by
3 3 votes
A/c to me its answer is option (b).

8, 15, 20, 47, 4, 9, 30, 40, 12, 17 b/c it uses two-way merge sort.

Take question as A: [20] [47] [15] [8] [9] [4] [40] [30] [12] [17]

After pass 1: [20,47] [15,8] [4,9] [30,40] [12,17]

After pass 2: [8,15,20,47] [4,9,30,40] [12,17]

After pass 3: [4,8,9,15,20,30,40,47] [12,17]

After pass 4: [4,8,9,12,15,17,20,30,40,47]
Answer:
Position:
Show:

Related questions

43 43 votes
6 answers 6 answers
16.6k
16.6k views
Kathleen asked Sep 23, 2014
16,600 views
The number of binary strings of $n$ zeros and $k$ ones in which no two ones are adjacent is$^{n-1}C_k$$^nC_k$$^nC_{k+1}$None of the above
36 36 votes
3 answers 3 answers
10.8k
10.8k views
Kathleen asked Sep 23, 2014
10,809 views
Let $A$ be an $n \times n$ matrix such that the elements in each row and each column are arranged in ascending order. Draw a decision tree, which finds $1$st, $2$nd and $...
32 32 votes
2 answers 2 answers
13.1k
13.1k views
Kathleen asked Sep 23, 2014
13,133 views
A sorting technique is called stable ifit takes $O (n \log n)$ timeit maintains the relative order of occurrence of non-distinct elementsit uses divide and conquer paradi...
73 73 votes
5 answers 5 answers
26.8k
26.8k views
Anu asked Jun 1, 2015
26,835 views
A hash table with ten buckets with one slot per bucket is shown in the following figure. The symbols $S1$ to $S7$ initially entered using a hashing function with linear p...