I have a query regarding nested loop question here. Why are we not multiplying th


#1

I have a query regarding nested loop question here.
Why are we not multiplying the no of times outer loop is executing i.e. log(n) times
then answer should be: O(nlog(n))


#2

see we are calculating the complexity already by considering the outer loop
like
n + n/2 + n/3…
here ‘n’ means for first time iteration of outer loop the inner loop executes ‘n’ times
n/2 means for second time iteration of outer loop the inner loop executes ‘n/2’ times
and so on.
and finally we are adding them all ( iterations of inner loop of all outer loop).


#3

Then why we are not considering the outer loop? It should also be considered !!


#4

@a-srinivasa-reddy: The outer loop is considered in @shubham_mishra_306’s explanation.