0 votes 0 votes Algorithms algorithms time-complexity numerical-answers made-easy-test-series + – Shadan Karim asked Dec 30, 2018 recategorized Jul 12, 2022 by Lakshman Bhaiya Shadan Karim 721 views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply Magma commented Dec 30, 2018 reply Follow Share 200 ?? 0 votes 0 votes Rishav Kumar Singh commented Dec 30, 2018 reply Follow Share @Shaik Masthan it's O(n^2) I think 0 votes 0 votes Magma commented Dec 30, 2018 reply Follow Share Yeah I too got O ( n^2 + nlogn) 0 votes 0 votes Shadan Karim commented Dec 30, 2018 reply Follow Share @Magma yes , its 200, please explain 0 votes 0 votes Magma commented Dec 30, 2018 reply Follow Share Outer Loop runs : log (n) times = {1 , 2 , 4 ,8 .....} for(i = 0 ;i<=n ; i+=2) = [0 , 2, 4 , 6 ,8 ....] --- > It even number times executed therefore --- > n/2 times executed for(j=1 ; j<n ; jx=2) ---> runs log n times sequence goes like = $\frac{n}{2} + log (n) + 2 (\frac{n}{2} + log n) + 4 (\frac{n}{2} + logn) ..... log n times$ $\frac{n}{2} (1+2+4+8...logn times)$ + $log n (1+2+4+8...logn times)$ = $\bigcirc (n^{2} + n logn) = \bigcirc (n^{2})$ 1 votes 1 votes bhanu kumar 1 commented Dec 31, 2018 reply Follow Share 1 doubt : Sir why you have not taken outer i loop with bound loop......Then their complexity should multiply ? only inner to should add. 0 votes 0 votes Please log in or register to add a comment.