Counting Sort 1

  • + 0 comments

    Typescript:

    function countingSort(arr: number[]): number[] {
        const out = new Array(100).fill(0);
        for (let i = 0; i < arr.length; ++i) {
            out[arr[i]]++
        }
        return out;
    }