complete merge_sort function for Section I