Category Archives: Sorting

3-way Merge Sort

Prerequisite – Merge Sort Merge sort involves recursively splitting the array into 2 parts, sorting and finally merging them. A variant of merge sort is called 3-way merge sort where instead of splitting the array into 2 parts we split it into 3 parts. Merge sort recursively breaks down the arrays to subarrays of size… Read More »

Serial Sort v/s Parallel Sort in Java

We often need to sort array while programming. For this, we use inbuilt method provided by Java in Arrays class i.e sort(). sort() method uses merge sort or Tim Sort to sort the array elements. In both the cases sort() method sequentially sort the elements of an array. In Java 8, there is a new… Read More »

Stooge Sort

The Stooge sort is a recursive sorting algorithm. It is defined as below (for ascending order sorting). Step 1 : If value at index 0 is greater than value at last index, swap them. Step 2: Recursively, a) Stooge sort the initial 2/3rd of the array. b) Stooge sort the last 2/3rd of the array.… Read More »