Last active
December 30, 2015 02:49
-
-
Save rsofaer/7765178 to your computer and use it in GitHub Desktop.
Complexity Classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
O(1) - Constant time | |
"Get the first value of a list" | |
"Random sample from a list" | |
O(logN) - Divide and Pick | |
Typical of algorithms that divide the input, then look at one of the sections | |
Searching sorted data | |
O(N) - For each .... | |
Sum an array | |
O(NlogN) - Divide and pick a section for every piece of input | |
Sorting | |
O(N^2) - For each piece of data, look at the data you haven't looked at yet (the rest of the list) | |
Insertion sort | |
O(N^3) - Naive Matrix Multiplication | |
drawing a graph with force layout | |
O(c^n) - One new piece of data doubles the work is 2^n | |
Playing chess is like this, looking one more move ahead multiplies the work | |
O(n!) - List all combinations of a set, every possible subset. | |
Naive travelling salesman | |
Almost never necessary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment