• Cube Sort is a relatively simple sorting algorithm that works well for a limited range of input values, such as integers or small ranges of numbers. It's not commonly used in practice due to its limited efficiency for larger datasets.

    Time Complexity The time complexity of the Cube Sort algorithm is O(n + k), where "n" is the number of elements in the input array, and "k" is the range of values (i.e., the difference between the maximum and minimum values in the array).

    Best Case: Ω(n) Average Case: O(n log(n)) Worst Case: O(n log(n))

    The overall time complexity is dominated by the counting phase because, in practice, "k" is often much smaller than "n." Therefore, the Cube Sort algorithm is typically considered to have a time complexity of O(n) in most practical cases.

    Space complexity: O(n)

    Parameters

    • arr: number[]

      unsorted array

    Returns number[]

    sorted array

    Function

    cubeeSort

Generated using TypeDoc