Doubt in 1 answer

shouldn’t it be log n
as it will go from (n, n/2,n/4,n/8…1)that actually when n/(2^k)==1…and k denotes number of times loop has run and this would give log n as the answer

in ques num 14 how we are incrementing the value of i

k is not no of times loop run

firstly loop run N times then n/2 times then n/4 times
so total no of times loop run= n+n/2+n/3+n4 …1=n
hence time complexity is O(n)

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.