Complexity
public enum Complexity : Equatable, Hashable, CaseIterable
extension Complexity: Comparable
The amount of computer time that it takes to run an algorithm.
This is an estimate of the number of elementary operations performed by the algorithm in relation to the number of elements the algorithm is operating on.
Algorithms that have the same complexity are equivalent for the sake of analysis. In practice they may have different running times.
-
O(1)
Declaration
Swift
case constant
-
O(2^n)
Declaration
Swift
case exponential
-
O(n!)
Declaration
Swift
case factorial
-
O(n)
Declaration
Swift
case linear
-
O(n*log(2,n))
Declaration
Swift
case linearithmic
-
O(log(2,n))
Declaration
Swift
case logarithmic
-
O(n^2)
Declaration
Swift
case quadratic
-
A collection of all complexity values from least complex to most complex.
Declaration
Swift
public static let allCasesInOrder: [Complexity]
-
Declaration
Swift
public static func < (lhs: `Self`, rhs: `Self`) -> Bool