mergesort in scala