Time Complexity
learning at a glance:
Time complexity | Name | Example |
1 | Constant | Adding an element to the front of a linked list |
logn | Logarithmic | Finding an element in a sorted array |
n | Linear | Finding an element in an unsorted array |
nlogn | Linear Logarithmic | Sorting n items by „divide-and-conquer‟-Mergesort |
n^2 | Quadratic | Shortest path between two nodes in a graph |
n^3 | Cubic | Matrix Multiplication |
2^n | Exponential | The Towers of Hanoi problem |
No comments:
Post a Comment