Skip to content

Commit 53958a4

Browse files
committed
improve
1 parent bdcd33e commit 53958a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

example/chen_sort.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,12 @@ void chenSort(List<int> list) {
194194
for (final bucket in buckets) {
195195
if (bucket != null) {
196196
if (bucket.length > 1) {
197-
/// The sort method here represents the fastest comparison-type algorithm (Quick sort, Tim sort, etc.)
198-
bucket.sort(compare);
197+
if (bucket.length >= 1000) {
198+
chenSort(bucket);
199+
} else {
200+
/// The sort method here represents the fastest comparison-type algorithm (Quick sort, Tim sort, etc.)
201+
bucket.sort(compare);
202+
}
199203
for (final element in bucket) {
200204
list[index++] = element;
201205
}

0 commit comments

Comments
 (0)