Correct Answer - Option 2 : O(n log
2 n) and O(log
2 n)
Merge sort
It is based on the divide and conquers approach.
Recurrence relation for merge sort will become:
T(n) = 2T (n/2) + Θ (n)
Using Master’s theorem
T (n) = n × log2n
Therefore, the time complexity of Merge Sort is θ(nlogn).
Binary Search
Search a sorted array by repeatedly dividing the search interval in half.
Recurrence for binary search is T(n) = T(n/2) + θ(1)
Using Master’s theorem
T (n) = log2n
Consider only half of the input list and throw out the other half. Hence time complexity is O(log n).