@jialin.huang
FRONT-ENDBACK-ENDNETWORK, HTTPOS, COMPUTERCLOUD, AWS, Docker
To live is to risk it all Otherwise you are just an inert chunk of randomly assembled molecules drifting wherever the Universe blows you

© 2024 jialin00.com

Original content since 2022

back
RSS

Big O - How fast it gets bad

As n gets bigger:

O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(n³) < O(2ⁿ) < O(n!)

—> —> —> —> —> —>—> —> —> —> —> —> being the absolute worst

n² vs n³

of course n³ is worse

n² vs 2ⁿ

crossover point is between 4 and 5.

2ⁿ
n=41616
n=52532

n³ vs 2ⁿ

The crossover happens after n=10.

2ⁿ
n=9729512
n=1010001024

n³ vs n!

The crossover happens after n=6.

n!
n=5125120
n=6216720

2ⁿ vs n!

The crossover happens much earlier, after n=3.

2ⁿ n!
n=386
n=41624

EOF