Back to Browse

Counting Sort JavaScript

315 views
Aug 17, 2023
12:14

Counting Sort is a sorting algorithm that utilizes key-value pair logic to order a collection of numbers. By creating an intermediate data structure(countArr in this case) we can place all numbers at their respective index. Because indices are sorted by default, we can now loop over this intermediate data structure and 'shoot out' our numbers in order. Counting Sort is O(n+k) time complexity where k is the 'range of values' you have to choose from. Counting Sort Source Code: https://github.com/Brixsta/Algorithms/blob/main/Sort/Counting%20Sort.js Chapters: 0:00 Intro 0:33 Counting Sort Explanation 5:15 Coding Counting Sort 11:28 Outro

Download

0 formats

No download links available.

Counting Sort JavaScript | NatokHD