DEV Community

Cover image for What is Big-O Notation? Understand Time and Space Complexity in JavaScript.

What is Big-O Notation? Understand Time and Space Complexity in JavaScript.

Chandra Prakash Tiwari on January 10, 2020

As we know, there may be more than one solution to any problem. But it is hard to define, what is the best approach and method of solving that prog...
Collapse
 
layzee profile image
Lars Gyrup Brink Nielsen

We will never be able to express the complexity of space-time with JavaScript 😄

Collapse
 
chandra profile image
Chandra Prakash Tiwari

Thank you Lars, Would you please explain to me why? It will really help me to learn more.

Collapse
 
layzee profile image
Lars Gyrup Brink Nielsen

It's a joke 😄 I was referring to space-time.

Collapse
 
kyleuk profile image
Kyle-uk

Thanks that was some nice examples.

I have tried a few times to understand Big-O notation and logarithms, but I never have and don't think I ever will.

Do you know of any resource in particular that helped you?

Collapse
 
chandra profile image
Chandra Prakash Tiwari

I have learned from Udemy. Its the best online solution out there.

Collapse
 
nyc4m profile image
Baptiste Prunot

I think you got a mistake in your article,
You should prefer O(log n) to O(n), it's the principle of binary tree 😁

Collapse
 
chandra profile image
Chandra Prakash Tiwari • Edited

Yes, thanks Baptiste for the correction. Please have a look at the graph. I think there is a little difference between the two.

Collapse
 
ypedroo profile image
Ynoa Pedro

Awesome post

Collapse
 
chandra profile image
Chandra Prakash Tiwari

Thanks Ynoa