1 1 vote How the worst case of merge sort is O(n^2) according to the given MIT assignment pdf:- explain ? Algorithms algorithms time-complexity mit-quiz + – Shubhanshu 1.2k views answer comment Share Follow Print See 1 comment 1 1 comment reply Dhruv Patel commented May 9, 2017 reply Follow flag That's true actually. $O(n^2)$ is not a tight upper bound, but it's an upper bound nevertheless. It's a big-oh notation. If it was theta notation, it would have been wrong. 1 1 replyShare Please log in or register to add a comment.
0 0 votes $\begin{align*} & \;\; \;\; \; F(x) = O(G(x)) \\ &\Rightarrow |F(x)| \leq {\bf c}|G(x)| \;\; \text{ for all } x \geq x_0 \text{ and } x_0,c > 0 \end{align*}$ In this QS : $\begin{align*} &F(x) = n\log_2 n \\ &G(x) = n^2 \\ &\text{We can easily observe that }\;\; n\log_2 n = O(n^2) \;\; \text{ for c = 1 and }x_0 = 2 \end{align*}$ dd answered May 9, 2017 dd comment Share Follow See all 3 Comments 3 3 Comments reply Shubhanshu commented May 9, 2017 reply Follow flag It means that they are not taking tightest upper bound, which is O(nlogn). and hence it can be said that it is worst case of merge sort is O(n^2) also ryt?? 0 0 replyShare dd commented May 9, 2017 reply Follow flag hence it can be said that it is worst case of merge sort is O(n^2) also : NO 1 1 replyShare Shubhanshu commented May 9, 2017 reply Follow flag then what?? and what is the difference between upper bound and worst case time complexity?? 1 1 replyShare Please log in or register to add a comment.