retagged by
5,863 views
1 votes
1 votes

Mergesort makes two recursive calls. Which statement is true after these two recursive calls finish, but before the merge step ?

  1. The array elements form a heap.
  2. Elements in each half of the array are sorted amongst themselves.
  3. Elements in the first half of the array are less than or equal to elements in second half of the array.
  4. All of the above 
retagged by

2 Answers

Best answer
5 votes
5 votes

Answer : B

Elements in each half of the array are sorted amongst themselves.

MergeSort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merg() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one. 

selected by
1 votes
1 votes

Merge sort is  possible only when two arrays are sorted. If two unsorted array are submitted to merge sort algorithm, it will sort each of them before merging them.

Option is B

Answer:

Related questions

2 votes
2 votes
3 answers
2
0 votes
0 votes
2 answers
3
makhdoom ghaya asked Jul 1, 2016
3,365 views
Match the following $:$$\begin{array} {cIcI} & \textbf{List – I} && \textbf{List – II} \\ \text{a.} & \text{DDL} & \text{i.} & \text{LOCK TABLE} \\ \text{b.} & \tex...
2 votes
2 votes
3 answers
4
makhdoom ghaya asked Jul 1, 2016
19,960 views
Let $R =\{A, B, C, D, E, F\}$ be a relation schema with the following dependencies $C \rightarrow F$, $E \rightarrow A$, $EC \rightarrow D$, $A \rightarrow B$. Which of t...