Given two sorted lists of size m and n respectively. The number of comparisons…
2017
Given two sorted lists of size m and n respectively. The number of comparisons needed in the worst case by the merge algorithm will be:
Answer: A. m + n − 1 — Correct Answer: m + n − 1 Explanation: Merge process: Repeatedly compare the smallest remaining elements of the two lists and move the smaller one into the…
- A.
m + n − 1
- B.
mn
- C.
max (m, n)
- D.
min (m, n)
Attempted by 1271 students.
Show answer & explanation
Correct answer: A
Correct Answer: m + n − 1 Explanation: Merge process: Repeatedly compare the smallest remaining elements of the two lists and move the smaller one into the output. Each comparison (in typical steps) causes one element to be placed into the merged list.
Loading lesson…