Database-Management-System
August 29, 2024Database-Management-System
August 29, 2024Database-Management-System
Question 557 |
Given two sorted list of size ‘m’ and ‘n’ respectively. The number of comparison needed in the worst case by the merge sort algorithm will be
m × n | |
max (m, n) | |
min (m, n) | |
m + n – 1 |
Question 557 Explanation:
→ To merge two lists of size m and n, we need to do m+n-1 comparisons in worst case. Since we need to merge 2 at a time, the optimal strategy would be to take smallest size lists first.
→ The reason for picking smallest two items is to carry minimum items for repetition in merging.
→ The reason for picking smallest two items is to carry minimum items for repetition in merging.
Correct Answer: D
Question 557 Explanation:
→ To merge two lists of size m and n, we need to do m+n-1 comparisons in worst case. Since we need to merge 2 at a time, the optimal strategy would be to take smallest size lists first.
→ The reason for picking smallest two items is to carry minimum items for repetition in merging.
→ The reason for picking smallest two items is to carry minimum items for repetition in merging.
Subscribe
Login
0 Comments