For challenge 3 of Introduction to Complexity Measure, I think the options are incorrect. Isn’t the correct answer O(log n) or O(log to the base 2 _ n)?
I don’t see O(log n) in the options.
Please correct me if I am wrong
For challenge 3 of Introduction to Complexity Measure, I think the options are incorrect. Isn’t the correct answer O(log n) or O(log to the base 2 _ n)?
I don’t see O(log n) in the options.
Please correct me if I am wrong
Hi Swapnil_Jadhav ,
This is Anum from Educative.
In algorithms, we are interested in a tight bound on the running time, which makes the time complexity O(n). The outer loop here runs log(n) times and the inner loop runs 2n -1 times.
Hence, the Big O Time Complexity is O(n)
We hope Educative has inspired you to further your learning.
Best Regards,
Anum Hassan | Developer Advocate
educative.io