1 votes 1 votes Programming in C time-complexity + – bahirNaik asked Jan 13, 2016 bahirNaik 373 views answer comment Share Follow See 1 comment See all 1 1 comment reply japurva1 commented Jan 13, 2016 reply Follow Share is it n2/log(n) ?? 0 votes 0 votes Please log in or register to add a comment.
Best answer 3 votes 3 votes complexity will be n+n/2+...1(logn terms) Solve using Geometric Progression Ans will be O(n) Pooja Palod answered Jan 13, 2016 • selected Jan 13, 2016 by bahirNaik Pooja Palod comment Share Follow See all 2 Comments See all 2 2 Comments reply shivanisrivarshini commented Jan 14, 2016 reply Follow Share for loop of i is O(log2n) and for loop of j is executed as many times of i i.e n+n/2+n/4 + ....... =O(n) so total time complexity is O(nlogn) can u correct me if im wrong 0 votes 0 votes Sourabh Kumar commented May 1, 2016 reply Follow Share O(n) 0 votes 0 votes Please log in or register to add a comment.