In this post we’ll implement Merge Sort in Java. It’s fast, divide and conquer, sorting algorithm that can also be parallelized.

How Merge Sort works

The algorithm belongs to the group of Divide and Conquer family of algorithms. This basically means that it divides the sorting problem into smaller parts to solve. The core of Merge Sort goes as follows:

When the array consists of only one element do nothing, because it is already sorted.

Find the middle point of array (or mid points when you want to split into more parts).

Recursively Merge Sort part of array from the start to the middle point.