Enumerations

The following enumerations are available globally.

  • 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.

    See more

    Declaration

    Swift

    public enum Complexity : Equatable, Hashable, CaseIterable
    extension Complexity: Comparable
  • A step in a sorting algorithm.

    This is the primary way that a sorting algorithm communicates with a caller. This is not a step in the literal sense of how a given sorting algorithm is implemented; this is a step as visible to the caller. A sorting algorithm may perform many operations internally but the caller will only ever see the comparisons. To the caller, a sorting algorithm is a sequence of steps: many comparisons followed by a terminal output.

    A sorting algorithm will return a step when executed (i.e. SortingAlgorithm.callAsFunction()). The step informs the caller of the current state of the algorithm and what is next required from the caller. If the step is of case comparison then the algorithm requires an answer to the comparison in order to continue. If the step is of case finished then the algorithm is finished and the sorted output is provided.

    In an abstract sense, a step is a node in tree of possible paths that a sorting algorithm can take.

    See more

    Declaration

    Swift

    public enum SortingAlgorithmStep<Algorithm> where Algorithm : SortingAlgorithm