
Patrick B. answered 10/11/20
Math and computer tutor/teacher
Suppose there are 100 inputs...
the loop will take 8 iterations:1 ,2,4,8,16,32,64,128
Suppose there are 1000 inputs...
the loop will take 11 iterations: 1,2,4,8,16,32,64,128,256,512,1025
Suppose there are 10000 inputs...
the loop will take 14 iterations: 1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384
So here's performance measure as a function of N, the # of inputs
N # of iterations
100 8
1000 11
10000 14
looks logarithmic to me.....
log(N)
Prachi K.
The 10000 input is taking 15 iterations not 14. And log(n) is totally fine but which function will be used ceiling or floor?10/11/20