Time complexity
f( ) { while(n>1) { for (i = 1 to n) { } n = n/2 } } g ( ) { for (i = 1 to 100n) { } }
@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.
@GO Classes please fix the formatting of the question.
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