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
1.2k views
in Information Technology by (103k points)
closed by
A list of n strings, each of length n, is sorted into lexicographic order using merge - sort algorithm. The worst case running time of this computation is:
1. O(n log n)
2. O(n2 log n)
3. O(n2 + log n)
4. O(n3)

1 Answer

0 votes
by (106k points)
selected by
 
Best answer
Correct Answer - Option 2 : O(n2 log n)

The correct answer is "option 2".

CONCEPT:

The Recurrence relation for the number of comparisons needed to sort an array of n integers is:

T(n) = 2T(n/2) + n

= O(nlog2n)

EXPLANATION:

Consider n strings of length n in place of each integer, since each integer takes O(1) time to sort then,

Complexity to sort one string of size n - O(n)

Complexity to sort n strings of size n - O(n * nlog2n) = O(n2log2n)

Hence, worst case running time is O(n2log2n).

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

...