Show Running Time Merge Sort Algorithm N Element Sequence O N Log N Even N Power 2 Please Q37116244

Show that the running time of the merge sort algorithm on nelement sequence is O(n log n), even when n is not a power of 2.Please explain simplistically.


Answer


merge sort makes two recursive calls of size n/2. 2T(n/2)and merge operation takes O(n) operations.so, recurrence relation is T(n) = 2T(n/2) + O(n)T(n) 2T(n/2) O(n) This is in the form of T(n)- aT(7) + /n) so, we can use masters theorem compare nos* d with f(n a 2, b 2,so, what ever the value of n is, time complexity of merge sort is O(n log n)T(n) 2T(n/2)

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.