Open In App

Algorithms | Sorting | Question 16

Like Article
Like
Save Article
Save
Share
Report issue
Report

A list of n string, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is

(A)

O (n*log(n))

(B)

O (n2 log n)

(C)

O (n2 + log(n))

(D)

O (n2)



Answer: (B)

Explanation:

The recurrence tree for merge sort will have height Log(n). And O(n^2) work will be done at each level of the recurrence tree (Each level involves n comparisons and comparison takes O(n) time in the worst case).

So time complexity of this Merge Sort will be O (n^2 log n)  .



Quiz of this Question
Please comment below if you find anything wrong in the above post

Last Updated : 30 Jul, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads