The for loop runs at most len times each iteration of while, it is geometric progression, so the runtime is actually O(n).
len
O(n)
Loading collection data...
The for loop runs at most
len
times each iteration of while, it is geometric progression, so the runtime is actuallyO(n)
.