Why option C is more efficient than B?


How we can conclude that multiplication operation *= is faster than += addition ?


continuously multiplying by 2 scales faster than adding 2. Example 1+2 = 2, 2+2=4, 4+2=6. On the other hand 12=2, 22=4, 4*2=8.


TC . A: O(n) B: O(n/2)–>O(n) C: O(logn) D: never ends


Value of i increase exponentially in option C but in B increased by +2 only


the most complex operation is division so put it out of league, out of the three A is just normal increment which is slower than the other two so we now eliminated A,D. We are left with B and C, now think that you want to add 5 20 times so which one you’d chose among them. Obviously multiply is more faster than addition so answer C is correct.