Big O Notation
Big O Notation classifies algorithms by their speed.
Last updated
Was this helpful?
Big O Notation classifies algorithms by their speed.
Last updated
Was this helpful?
Big O Notation classifies types of algorithms by there speed. Big O Notation is used to determine how long an algorithm will take to complete.
The point of Big O Notation is to give the user an idea of how fast or slow an algorithm will take to complete.
Big O Notation works by approximating the total amount of steps an algorithm will take. lets create a list of the numbers 1 through 100 and classify different algorithms by their speed.
Fastest completion time possible
Fixed amount of steps
Example: 1 + 100
2 steps
Fast Completion Time
The steps are a small fraction(log) of the size of the data
Example: 0 + 75 + 88 + 94 + 97 + 99
6 steps
Completion time is okay
Steps are the size of the data
Example: 1+2+3+4+5...100
100 steps
Completion time is slow
Steps are size of the data squared
Example: [1+2+3..100] + [2+3+4..100] + [3+4+5..100]...
5050 steps
Seconds?
Minutes?
Hours?
Days?
Years?
Centuries?
Millennia?
Eons?
O(1)
O(log(N))
O(N)
O(N^2)
Important to note as the size of the data grows, run times can approach infinity