Merge sort algorithm. Merge function implemented.