[英]What sort algorithm does the dart's list library use?
Does the sort function use the Quick Sort algorithm? 排序功能是否使用快速排序算法?
https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:core.List#id_sort https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:core.List#id_sort
The source code for Sort
is here . Sort
的源代码在这里 。 Sort calls a _doSort
helper method, which looks like this: Sort调用
_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);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.