Discussion
Mergesort makes two recursive calls. Which statement is true after these two recursive calls finish, but before the merge step ?
Answer: B
After the two recursive calls and before the merge, the elements in each half of the array are sorted among themselves. Mergesort sorts the left half and the right half separately and then merges them, so at this point each half is in order, but there is no relation between the halves, so the first half need not be smaller than the second and the array does not form a heap. The statement that all of them hold is therefore false. The merge step then combines the two sorted halves into one, and it is only after that step that the whole array is in order.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development