5
While(n>=1)
{
    n=n/20;
    n=n/6;
    n=10×n;
    n=n-10000;
}

I tried like this =>

In this loop, N gets reduced by N/12 - 10000. so, time complexity is O(log N).

Garrick
  • 677
  • 4
  • 15
  • 34
  • 1
    If you have an idea what the complexity might be, you can calculate concrete values for some n and compare the resulting graph with the assumed complexity. If both graphs are similar, you can start to find a prove why your assumption is correct. – MrSmith42 Sep 05 '16 at 08:07
  • thanks! i will keep that in mind – Garrick Sep 05 '16 at 08:08
  • 1
    Please don't post what is basically the same question every few hours (http://stackoverflow.com/questions/39324836/what-is-the-time-complexity-of-given-code). You may want to read a more general Q&A first, like: http://stackoverflow.com/questions/11032015/how-to-find-time-complexity-of-an-algorithm – m69's been on strike for years Sep 05 '16 at 12:15

1 Answers1

6

That seems to be correct. If this is an exercise, you should be prepared to argue why O(log_12(N))is O(log(N)).

mort
  • 12,988
  • 14
  • 52
  • 97