Copied from algorithms.dart, Copyright (c) 2013, the Dart project authors.
Sorts a list between start (inclusive) and end (exclusive) using the
merge sort algorithm.
If compare is omitted, this defaults to calling Comparable.compareTo on
the objects. If any object is not Comparable, this throws a TypeError.
Merge-sorting works by splitting the job into two parts, sorting each
recursively, and then merging the two sorted parts.
This takes on the order of n * log(n) comparisons and moves to sort
n elements, but requires extra space of about the same size as the list
being sorted.
This merge sort is stable: Equal elements end up in the same order
as they started in.