Javascript Algorithms — Counting Sort

Kyle Jensen
Javascript Algorithms
4 min readFeb 23, 2018

--

In this post, we’ll be introduced to our first non-comparison sorting algorithm — counting sort! By being a non-comparison algorithm, counting sort doesn’t really care about what the other elements in a list are when it’s figuring out the sorted position of any given element, and you’ll see why when we dive into the theory behind it. Counting sort is a stable sort, and runs in O(n + k), or linear, time where n is the size…

--

--

Kyle Jensen
Javascript Algorithms

Founder/CEO of Zealist (check us out!) & Polarity Labs. Twitter @_kylejensen