retagged by
652 views
1 votes
1 votes

How the worst case of merge sort is O(n^2) according to the given MIT assignment pdf:-

explain ?

retagged by

1 Answer

0 votes
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*}$

Related questions

0 votes
0 votes
1 answer
1
sushmita asked Sep 28, 2018
913 views
Find the complexity of the following code fragment:int i = 1; for(; i <= n logn; i++) { for(i++; i <= n; i++) { printf("1") } }
1 votes
1 votes
2 answers
2
sushmita asked Sep 28, 2018
773 views
Find the complexity of the following function when called with some integer n:void foo(n) { int i,j,k,x=0; for (i=1 ; i <= n ; i++) for (j=1 ; j <= i * i ; j++) for ( k ...
0 votes
0 votes
2 answers
3
sushmita asked Sep 28, 2018
851 views
FIND THE TIME COMPLEXITYint i=1,j; for(;i <= n;i + +) { for(j = i; j <= nlogn; j∗= 2) { sum++; } }
2 votes
2 votes
3 answers
4
sushmita asked Mar 21, 2017
7,101 views
For each group of functions, sort the functions in increasing order of asymptotic (big-O) complexity:$\begin{align*} &(a) \;\;f1(n) = n^{0.999999} * \log n \\ &(b) \;\;f2...