make compare and swap functions public
This commit is contained in:
parent
ad9f69de9d
commit
14d2966b51
1 changed files with 3 additions and 3 deletions
|
@ -15,11 +15,11 @@ pub fn print_list(list: &[u64]) {
|
|||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
enum CompareResult {
|
||||
pub enum CompareResult {
|
||||
LESS, EQUAL, GREATER
|
||||
}
|
||||
|
||||
fn compare(a: u64, b: u64, comparisons: &mut u64) -> CompareResult {
|
||||
pub fn compare(a: u64, b: u64, comparisons: &mut u64) -> CompareResult {
|
||||
*comparisons += 1;
|
||||
if a < b {
|
||||
CompareResult::LESS
|
||||
|
@ -30,7 +30,7 @@ fn compare(a: u64, b: u64, comparisons: &mut u64) -> CompareResult {
|
|||
}
|
||||
}
|
||||
|
||||
fn swap(list: &mut [u64], i: usize, j: usize, swaps: &mut u64) {
|
||||
pub fn swap(list: &mut [u64], i: usize, j: usize, swaps: &mut u64) {
|
||||
*swaps += 1;
|
||||
list.swap(i, j);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue