in Algorithms closed by
628 views
0 votes
0 votes
closed as a duplicate of: GATE CSE 2023 | Question: 44

Time complexity

 f( )
 {
    while(n>1) 
    {
        for (i = 1 to n)
        { 
        }
        n = n/2
    }
 }
 g ( )
 {
    for (i = 1 to 100n)
    {
    }
 }

 

 

  1. $f(x)=O(g(x))$
  2. $f(x)=\theta(g(x))$
  3. $f(x)=o(g(x))$
  4. $f(x)=\omega(g(x))$

 

in Algorithms closed by
628 views

4 Comments

@Hira Thakur

I just thought that while loop is running log(n) times and the inner for loop is running n times. so nlogn. I must be wrong about this process then.

1
1

@GO Classes please fix the formatting of the question.

0
0

The formatting of the question has been corrected.

Answer will be Option $A,B.$

$f(x) = \Theta(x)$ ; $g(x) = \Theta(x)$

So, $f(x) \in \Theta(g(x))$ and $f(x) \in O(g(x))$

Video Solution:

Algo: Two functions' Comparison

1
1
Answer:

Related questions