September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -36,12 +36,13 @@ fn partition<T,F>(v: &mut [T], f: &F) -> usize
|
|||
{
|
||||
let len = v.len();
|
||||
let pivot_index = len / 2;
|
||||
let last_index = len - 1;
|
||||
|
||||
v.swap(pivot_index, len - 1);
|
||||
v.swap(pivot_index, last_index);
|
||||
|
||||
let mut store_index = 0;
|
||||
for i in 0..len - 1 {
|
||||
if f(&v[i], &v[len - 1]) {
|
||||
for i in 0..last_index {
|
||||
if f(&v[i], &v[last_index]) {
|
||||
v.swap(i, store_index);
|
||||
store_index += 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue