Stable Sorting In JavaScript

JavaScript 2017 specification states the following about its built-in sorting, “The elements of this array are sorted. The sort is not necessarily stable (that is, elements that compare equal do not necessarily remain in their original order).” What’s a JavaScript programmer to do if a stable sort is needed? Good examples of stable and unstable sorting […]

Read more "Stable Sorting In JavaScript"

Radix Sort Implementations

Radix Sort is a high performance linear time sorting algorithm, which does not use comparisons. Instead, Radix Sort looks at each digit of the key and processes based on those digits. Two variations of the algorithm exit: least significant digit (LSD), and most significant digit (MSD). Each of the two variations has its own attributes, […]

Read more "Radix Sort Implementations"

Faster Sorting in JavaScript

JavaScript is taking over the world as the language of the web. When it comes to sorting, JavaScript is about 9 times slower than C++ and C#, but is slightly faster than Python 3.6, as I’ve shown in the previous post Sorting Speed of Several Languages. In this post, let’s explore the possibility of sorting faster in […]

Read more "Faster Sorting in JavaScript"

C++ Sorting Algorithms

The above graph compares performance of  several different sorting algorithms implemented in C++. X-axis is the array size being sorted. Y-axis is the time in seconds it took to sort the array. The faster the algorithm, the less time it takes to sort. The above graph is for arrays filled with uniformly distributed random unsigned […]

Read more "C++ Sorting Algorithms"

CPU Parallel Random Number Generator

Intel’s 2017 MKL random number generator functions do not provide parallel functions, but provide mechanisms to support multi-threaded generation. Some of these algorithms are bound by memory performance and run significantly faster when the array fits in the processor cache. These algorithms should scale well running on multiple cores when each array fits in non-shared […]

Read more "CPU Parallel Random Number Generator"