sort函数是否使用Quick Sort算法?
https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:core.List#id_sort
答案 0 :(得分:5)
Sort
的源代码是here。排序调用_doSort
辅助方法,如下所示:
static void _doSort(List a, int left, int right, int compare(a, b)) {
if ((right - left) <= _INSERTION_SORT_THRESHOLD) {
_insertionSort(a, left, right, compare);
} else {
_dualPivotQuicksort(a, left, right, compare);
}
}