ISRO-2018
February 13, 2024ISRO-2018
February 13, 2024ISRO-2018
Question 10 |
Given two sorted list of size m and n respectively. The number of comparisons needed the worst case by the merge sort algorithm will be
m*n | |
maximum of m and n | |
minimum of m and n | |
m+n–1 |
Question 10 Explanation:
Here the maximum number of comparisons is m+n-1.
For example: Take 2 sub-arrays of size 3 such as 1,3,5 and another subarray 2,4,6. Then in this case number of comparisons is 5 which is m+n-1 can be taken as O(m+n).
For example: Take 2 sub-arrays of size 3 such as 1,3,5 and another subarray 2,4,6. Then in this case number of comparisons is 5 which is m+n-1 can be taken as O(m+n).
Correct Answer: D
Question 10 Explanation:
Here the maximum number of comparisons is m+n-1.
For example: Take 2 sub-arrays of size 3 such as 1,3,5 and another subarray 2,4,6. Then in this case number of comparisons is 5 which is m+n-1 can be taken as O(m+n).
For example: Take 2 sub-arrays of size 3 such as 1,3,5 and another subarray 2,4,6. Then in this case number of comparisons is 5 which is m+n-1 can be taken as O(m+n).
Subscribe
Login
0 Comments