Two way merge-sort algorithm