What does a merge sort algorithm do