-
Notifications
You must be signed in to change notification settings - Fork 0
EpsteinSort Guide
github-actions[bot] edited this page Jun 14, 2026
·
1 revision
EpsteinSort 会先过滤,再排序。只有 [0, 18) 内的值能留下来。
当你需要固定区间过滤加排序,而不是通用排序时可以用它。像爱泼斯坦先生一样,保留并排序未成年人!
var values = new[] { 18, 0, -5, 17, 5, 18, 2, -1 };
var result = EpsteinSorter.RetainOnlyMinorsAndSort(values);
// result = [0, 2, 5, 17]- 过滤规则固定是
[0, 18)。 - 比较器只影响排序,不影响过滤。
- 对浮点类型,
NaN和正负无穷都会被删除。