0

I am working on time complexity. I have read some books, but still I think I can only understand basic staff. I have a 4 stage loop as an example and I am trying to calculate time complexity for it.

for(n=0;n<10000;n++)
    for(i=n; i>0; i=i/2)
        for(j=1; j<i; j=j*2)
            for(k=n;k--;)

So starting from the inner part of the loop I am sure that it will be executed n-1 times. Also the outer part is also n times.. But can't figure out the other 2 loops complexity and how I will calculate the total. To be more specific, I suspect that they have a logn complexity, but I really think I get it wrong..

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
baskon1
  • 330
  • 1
  • 3
  • 15
  • Possible duplicate of [How to find time complexity of an algorithm](http://stackoverflow.com/questions/11032015/how-to-find-time-complexity-of-an-algorithm) – Carcigenicate Jan 28 '17 at 19:03
  • I have read this, and other posts, but still get confused with all of this.. Sorry, I am new at this topic! – baskon1 Jan 28 '17 at 19:09

0 Answers0