DEV Community

Discussion on: Understanding Big-O Notation With JavaScript

Collapse
 
iyunusov profile image
Islomjon

I might be wrong here, but I think your Logarithmic time O(log(n)) leads to infinite looping. i < n should be applied.

Collapse
 
b0nbon1 profile image
Bonvic Bundi • Edited

Thanks, @islomjon for noting that. It is fixed now

Collapse
 
crisdan1905 profile image
Cristian Danilo Gutiérrez

I was to say the same. I think you got an error here. Otherwise, great explanation, thanks for the post. It's really useful!

Collapse
 
kjivan profile image
Kavi Jivan

I didn't notice that. Good Catch! Actually I think it will never run since i will never be bigger than n.