Tag Archives: Mergesort

Sorting part 2

Now let’s try to implement some other sorting algorithms. Let’s start with selectsort. We have a list of elements that we want to sort. We can divide it into two parts, sorted and unsorted.  In selectsort in each step we have to select smallest element from the unsorted part of the list and put it […]


Mergesort algorithm in Java – Code Example

Mergesort algorithm in Java – Code Example

In this article, we will discuss about the Mergsort algorithm. The Mergersort algorithm is much more efficient than some of the other sorting algorithms.

The Mergesort works by sorting and merging two arrays into one. The basic concept of the Mergesort algorithm is the merging of two already sorted-arrays into one array. In the next section, will show how merging works in the Mergesort algorithm.