//

Time Complexities Table

Here is a list of some of the common time complexities.

Time ComplexitiesNameExample
O(1)Constant– Accessing an element of an array
– Adding element at beginning of a linked list
O(log n)Logarithmic– Finding an element in a sorted array
O(n)Linear– Finding an element in an unsorted array
O(n log n)Linear Logarithmic– Sorting elements in an array using merge sort algorithm
O(n2)Quadratic– Shortest path between. 2 nodes in a graph
O(n3)Cubic– Matrix multiplication
O(2n)Exponential– The tower of Hanoi

Leave a Reply

Your email address will not be published. Required fields are marked *