1 个不稳定版本

使用旧的Rust 2015

0.1.0 2017年1月18日

1434 in 数据结构

MIT 许可证

8KB
196

沙堆

Rust中的沙堆实现。进行中。

Build Status

使用示例

extern crate sandpile;
use sandpile::Sandpile;

fn main() {
    let rows = 3;
    let cols = 3;

    // Create a new sandpile.
    let a = Sandpile::new(rows, cols, Some(vec![1,2,3,1,2,3,1,2,3]));

    // Create another sandpile.
    // Since no initialization data is provided,
    // the sandpile will be populated with 0s
    let b = Sandpile::new(rows, cols, None);

    // We have overloaded the '+' operator for sandpiles.
    let c = a + b;

    println!("{}", c);
}
/*
Output: 
1 | 2 | 3 | 
1 | 2 | 3 | 
1 | 2 | 3 | 
*/

许可证

MIT


lib.rs:

沙堆 是一个用于实验已知沙堆数据结构的库。这受到了Numberphile视频中相同主题的启发。

无运行时依赖