Big O Notation
There are lots of existing algorithms; some are fast and some are slow. Some use lots of memory. It can be hard to decide which algorithm is the best to solve a particular problem. “Big O” analysis (pronounced “Big Oh”, not “Big Zero”) is one way to compare algorithms.
Big O is a characterization of algorithms according to their worst-case growth rates
We write Big-O notation like this:
O(formula)
Where formula describes how an algorithm’s run time or space requirements grow as the input size grows.
- O(1) - constant
- O(n) - linear
- O(n^2) - squared
- O(2^n) - exponential
- O(n!) - factorial
References
Next -> big-o-notation-formal-definition
Next -> big-o-summary
#computer_science #boot_dev #big_o #programming #algorithm #notation