fixed csharp sort
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
# Seeds for failure cases proptest has generated in the past. It is
|
||||
# automatically read and these particular cases re-run before any
|
||||
# novel cases are generated.
|
||||
#
|
||||
# It is recommended to check this file in to source control so that
|
||||
# everyone who runs the test benefits from these saved cases.
|
||||
cc aae32727f89a3bbed40390df4d260ec2206af666c17147c2ff550efe2e388594 # shrinks to mut actual = [3, 0, 0, 0]
|
||||
+7
-17
@@ -67,9 +67,7 @@ where
|
||||
super::swap(keys, mid, hi - 1);
|
||||
let mut left = lo;
|
||||
let mut right = hi - 1;
|
||||
|
||||
let mut pivot_idx = right;
|
||||
let mut next_left = true;
|
||||
let pivot_idx = right;
|
||||
|
||||
while left < right {
|
||||
while {
|
||||
@@ -89,14 +87,6 @@ where
|
||||
}
|
||||
|
||||
super::swap(keys, left, right);
|
||||
|
||||
if next_left {
|
||||
pivot_idx = left;
|
||||
} else {
|
||||
pivot_idx = right;
|
||||
}
|
||||
|
||||
next_left = !next_left;
|
||||
}
|
||||
|
||||
super::swap(keys, left, hi - 1);
|
||||
@@ -109,14 +99,14 @@ where
|
||||
F: Fn(&T, &T) -> Ordering,
|
||||
{
|
||||
for i in lo..hi {
|
||||
let target = &keys[i + 1];
|
||||
let t = &keys[i + 1];
|
||||
|
||||
let smaller_idx = keys[lo..=i]
|
||||
let shift = keys[lo..=i]
|
||||
.iter()
|
||||
.rposition(|curr| cmp(target, curr).is_ge());
|
||||
.rev()
|
||||
.take_while(|curr| cmp(t, curr).is_lt())
|
||||
.count();
|
||||
|
||||
if let Some(idx) = smaller_idx {
|
||||
keys[lo + idx + 1..=i + 1].rotate_right(1);
|
||||
}
|
||||
keys[i + 1 - shift..=i + 1].rotate_right(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user