Merge Sort Code

By | May 24, 2014

Merge Sort belongs to category of divide and conquer algorithms. Which means it divides the problem into  small subproblems, solves them and then combine the solutions of these subproblems to generate solution  of the original problem.Merge Sort compares elements with each other for sorting the list.

The steps followed to mergesort are are:

  1. Divide the unsorted list into n sublists, each containing single element .
  2. Repeatedly merge(involves comparing elements of the sublists) sublists to produce new sublists until there is only 1 sublist remaining. This will be the sorted list.

 For more information on merge sort visit http://en.wikipedia.org/wiki/Merge_sort

Below is the code for merge sort algorithm.
CODE:

Leave a Reply

Your email address will not be published. Required fields are marked *