0 votes 0 votes find time complexity f(int n){ int i=1; while(i<n) { int j=n; while(j>0) j=j/2; i=i*2; } } Algorithms time-complexity + – amit166 asked Sep 11, 2018 amit166 212 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Time complexity=O(square(log(n))) Mohit Kumar 6 answered Sep 11, 2018 Mohit Kumar 6 comment Share Follow See 1 comment See all 1 1 comment reply Shaik Masthan commented Sep 11, 2018 reply Follow Share @Mohit Kumar 6 your answer is correct, but where is explanation? Questioner is also known the answer but didn't know the procedure to solve it, then what he/she gains from your answer ? if you didn't add the explanation then add it as comment. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes First it evalutes inside while loop upto logn to the base2 times and then the first while apply on 2nd while loop and the final result produces O(logn.logn) which means O(square(logn)) kondetichandu answered Sep 14, 2018 kondetichandu comment Share Follow See all 0 reply Please log in or register to add a comment.