-
Notifications
You must be signed in to change notification settings - Fork 0
ThanosSort Guide
github-actions[bot] edited this page Jun 14, 2026
·
1 revision
ThanosSort 会反复随机删除一半元素,直到剩余结果有序。
当你想保留原顺序,但接受用随机裁剪换取“最终有序”时可以用它。灭霸在此!
var values = new[] { 5, 1, 4, 4, 2, 3 };
var result = ThanosSorter.PruneUntilSorted(
values,
comparer: null,
removalStrategy: RemovalCountStrategy.CeilingHalf,
random: new Random(2026));- 它不是随机排序,而是随机删到有序。
- 幸存元素仍保持原有相对顺序。
- 固定随机种子时结果可复现。