Question 22 – ISRO-2018
February 13, 2024GATE 1995
February 13, 2024GATE 1995
Question 16 |
For merging two sorted lists of sizes m and n into a sorted list of size m+n, we required comparisons of
O(m) | |
O(n) | |
O(m+n) | |
O(logm+logn) |
Question 16 Explanation:
In best case, no. of comparisons is Min(m,n).
In worst case, no. of comparisons is m+n-1.
Then we require O(m+n) comparisons to merging two sorted lists.
In worst case, no. of comparisons is m+n-1.
Then we require O(m+n) comparisons to merging two sorted lists.
Correct Answer: C
Question 16 Explanation:
In best case, no. of comparisons is Min(m,n).
In worst case, no. of comparisons is m+n-1.
Then we require O(m+n) comparisons to merging two sorted lists.
In worst case, no. of comparisons is m+n-1.
Then we require O(m+n) comparisons to merging two sorted lists.