#sorting #step #terms #test

sort-visual

按步骤排序术语

1 个不稳定版本

0.0.0 2023年3月22日

#25 in #terms

MPL-2.0 许可证

32KB
576

#[test]
fn sort_step_by_step() {
    let numbers = [5, 9, 3, 6, 8, 2, 1, 7, 4];
    println!("Bubble Sort Steps:");
    for (i, v) in bubble_sort(&numbers).enumerate() {
        println!("#{}: {:?}", i, v);
    }
    println!("Insertion Sort Steps:");
    for (i, v) in insertion_sort(&numbers).enumerate() {
        println!("#{}: {:?}", i, v);
    }
    println!("Pancake Sort Steps:");
    for (i, v) in pancake_sort(&numbers).enumerate() {
        println!("#{}: {:?}", i, v);
    }
}

#[test]
fn bogo_step_by_step() {
    let numbers = [3, 4, 1, 2, 5];
    println!("Bogo Sort Steps:");
    for (i, v) in bogo_sort(&numbers).enumerate() {
        println!("#{}: {:?}", i, v);
    }
}

依赖项

~13MB
~65K SLoC