Implementing the Merging sort