Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
366 views
in Information Technology by (240k points)
closed by
Time complexity of Merge Sort Algorithm and Binary Search Algorithm are respectively:
1. O(log2 n) and O(n log2 n)
2. O(n log2 n) and O(log2 n)
3. O(n2) and O(log2 n)
4. O(2n) and O(n2)

1 Answer

0 votes
by (238k points)
selected by
 
Best answer
Correct Answer - Option 2 : O(n log2 n) and O(log2 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).

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...