For(int i=1;i<=n;i*=2) Statement I'm making notes for competitive exam and made this problem. But I'm not getting solution. Is it O( log n)? If so why?
Asked
Active
Viewed 15 times
0
-
Welcome to Computer Science! What have you tried? Where did you get stuck? We do not want to just hand you the solution; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for a relevant discussion. If you are uncertain how to improve your question, why not ask around in [chat]? You may also want to check out our reference questions. – Raphael Aug 13 '16 at 16:11
-
See also questions tagged [tag:algorithm-analysis+loops]. – Raphael Aug 13 '16 at 16:11
-
Try what happens if n = 1,000,000. That should help understanding and answering the "why". – gnasher729 Aug 15 '16 at 16:29