Big-O Flashcards
What is “Big-O” ?
The language and metric we use to describe the efficiency of algorithms.
Also called “Asymptotic Runtime”
Refers to how much time or space an algorithm will use, generally based on an input size “n”
It is a rough upper bound for worst cases and large inputs
Common Big-O Runtimes
- O(1) - Constant
- O( log N ) - Logarithmic
- O( N ) - Linear
- O( N log N ) - Log Linear
- O( N2 ) - Quadratic
- O( N3 ) - Cubic
- O( 2N ) - Exponential
- O( N! ) - Factorial
Which has the higher complexity?
O(N)
or
O( 1 )
O( N )
Which has the higher complexity?
O(N)
or
O( log N )
O( N )
Which has the higher complexity?
O(N)
or
O( N log N )
O( N log N )
Which has the higher complexity?
O(N log N)
or
O( 1 )
O( N log N )
Which has the higher complexity?
O(N2)
or
O( 1 )
O( N2 )
Which has the higher complexity?
O( N3 )
or
O( 1 )
O( N3 )
Which has the higher complexity?
O( 1 )
or
O( 2N )
O( 2N )
Which has the higher complexity?
O( N! )
or
O( 1 )
O( N! )
Which has the higher complexity?
O( log N )
or
O( N log N )
O( N log N )
Which has the higher complexity?
O( N2 )
or
O( log N )
O( N2 )
Which has the higher complexity?
O( log N )
or
O( N3 )
O( N3 )
Which has the higher complexity?
O( 2N )
or
O( log N )
O( 2N )
Which has the higher complexity?
O( log N )
or
O( N! )
O( N! )
Which has the higher complexity?
O( N )
or
O( N2 )
O( N2 )
Which has the higher complexity?
O( N3 )
or
O( N )
O( N3 )
Which has the higher complexity?
O( N )
or
O( 2N )
O( 2N )
Which has the higher complexity?
O( N! )
or
O( N )
O( N! )