back/merge_sort library

Functions

defaultCompare<T>() Comparator<T>
Returns a Comparator that asserts that its first argument is comparable.
stableSort<T>(List<T> list, {int start = 0, int? end, int compare(T a, T b)?}) → void
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.