MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the worst case complexity of Merge sort?
A
O(n log n)
B
O(log n)
C
O(n)
D
O(n2)
Explanation: 

Detailed explanation-1: -Merge Sort is an efficient, stable sorting algorithm with an average, best-case, and worst-case time complexity of O(n log n).

Detailed explanation-2: -Explanation: The time complexity of merge sort is not affected by worst case as its algorithm has to implement the same number of steps in any case. So its time complexity remains to be O(n log n).

Detailed explanation-3: -Mergesort is a divide and conquer algorithm and is O(log n) because the input is repeatedly halved.

Detailed explanation-4: -Time Complexity of Binary Search: The time complexity of Binary Search in the best case is O(1). In the worst case, the time complexity is O(log n).

There is 1 question to complete.