Table of common time complexities Further information: Computational complexity of mathematical operations The following table summarises some classes of commonly encountered time complexities. In the table, poly(x) = xO(1), i.e., polynomial in x. Name Complexity class constant time Running Examples of time (T(n)) running times O(1) inverse Ackermann time iterated logarithmic time 10 O(α(n)) O(log* n) log-logarithmic logarithmic time DLOGTIME O(log n) log n, log(n2) polylogarithmic poly(log n) (log n)2 time O(nc) where 0 1/2 2/3 n ,n fractional power <c<1 cubic time polynomial time P quasi-polynomial QP time sub-exponential time SUBEXP Amortized time per operation using a bounded priority queue[1] Binary search Searching in a kd-tree Finding the smallest item in an unsorted array Seidel's polygon triangulation O(n log* n) algorithm. O(n log n) n log n, log n! Fastest possible comparison sort 2 O(n ) n2 Bubble sort; Insertion sort Naive multiplication of two n×n 3 3 O(n ) n matrices. Calculating partial correlation. Karmarkar's algorithm for 2O(log n) = n, n log n, n10 linear programming; AKS poly(n) primality test Best-known O(log2 n)poly(log n) log log n log n 2 n ,n approximation algorithm for the directed Steiner tree problem. Assuming complexity theoretic O(2nε) for all O(2log nlog log n) conjectures, BPP is contained in ε>0 O(n) "n log star n" time linearithmic time quadratic time Determining if an integer (represented in binary) is even or odd Amortized time per operation using a disjoint set Distributed coloring of cycles O(log log n) linear time Example algorithms n 1 http://en.wikipedia.org/wiki/Time_complexity#Table_of_common_time_complexities (first definition) sub-exponential time (second definition) SUBEXP.[2] o(n) 2 O(n) 2 Best-known algorithm for integer factorization and graph isomorphism n1/3 n exponential time E 2 1.1 , 10 factorial time O(n!) n! exponential time EXPTIME 2poly(n) 2n, 2n2 n double 2-EXPTIME 22poly(n) exponential time 23n Solving the traveling salesman problem using dynamic programming Solving the traveling salesman problem via brute-force search Deciding the truth of a given statement in Presburger arithmetic 2 http://en.wikipedia.org/wiki/Time_complexity#Table_of_common_time_complexities
© Copyright 2026 Paperzz