add immutable select k
This commit is contained in:
parent
2d8f0a46f3
commit
e791acc2fe
1 changed files with 6 additions and 2 deletions
|
@ -112,9 +112,13 @@ impl NormalSelect {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn select_k(&mut self, list: &mut Vec<u64>, order_statistic: usize, k: usize) -> u64 {
|
||||
pub fn select_k_mut(&mut self, list: &mut Vec<u64>, order_statistic: usize, k: usize) -> u64 {
|
||||
self._select(list, 0, list.len() - 1, order_statistic, k).1
|
||||
}
|
||||
pub fn select_k(&mut self, list: &Vec<u64>, order_statistic: usize, k: usize) -> u64 {
|
||||
let mut list_clone = list.clone();
|
||||
self._select(&mut list_clone, 0, list.len() - 1, order_statistic, k).1
|
||||
}
|
||||
}
|
||||
|
||||
impl Select for NormalSelect {
|
||||
|
@ -128,7 +132,7 @@ impl Select for NormalSelect {
|
|||
}
|
||||
|
||||
fn select_mut(&mut self, list: &mut Vec<u64>, order_statistic: usize) -> u64 {
|
||||
self.select_k(list, order_statistic, 5)
|
||||
self.select_k_mut(list, order_statistic, 5)
|
||||
}
|
||||
|
||||
fn num_comp(&self) -> u64 {
|
||||
|
|
Loading…
Reference in a new issue