Comment body goes here.

Help me guys and please explain this

```
A) for(i = 0; i < n; i++)
B) for(i = 0; i < n; i += 2)
C) for(i = 1; i < n; i *= 2)
D) for(i = n; i > -1; i /= 2)
```which is faster and why?
```

Comment body goes here.

Help me guys and please explain this

```
A) for(i = 0; i < n; i++)
B) for(i = 0; i < n; i += 2)
C) for(i = 1; i < n; i *= 2)
D) for(i = n; i > -1; i /= 2)
```which is faster and why?
```

A) Loop goes from i=0 to i = n-1 with i incrementing by 1 after each turn. So loop will run n times. Thus time taken is O(n)

B) Loop goes from i=0 to i = n-1 with i incrementing by 2 after each turn. Hence loop will iterate n/2 times so the time complexity is O(n). Faster than (A)

C) Loop goes from i=1 to n with i getting multiplied by 2 at each turn. Hence loop iterations get divided by 2 after each turn. Thus time complexity log(n) (Base 2). Hence O(log(n)). Faster than (A) and (B).

D) Loop goes from i=n until i>-1. Now i = i/2 after each turn. At last i will become 0 but condition is i>-1. Which will always be satisfied because i=0/2 = 0>-1. So this will be infinite loop.