sorting_networks

Crates.iosorting_networks
lib.rssorting_networks
version0.1.0
sourcesrc
created_at2018-03-11 16:29:19.865355
updated_at2018-03-11 16:29:19.865355
descriptionAn implementation of sorting networks.
homepagehttps://github.com/regexident/sorting_networks
repositoryhttps://github.com/regexident/sorting_networks
max_upload_size
id55009
size152,920
Vincent Esche (regexident)

documentation

https://docs.rs/sorting_networks

README

sorting_networks

Build Status Downloads Version License

Synopsis

An implementation of sorting networks in Rust.

Motivation

In computer science, comparator networks are abstract devices built up of a fixed number of "wires", carrying values, and comparator modules that connect pairs of wires, swapping the values on the wires if they are not in a desired order. Such networks are typically designed to perform sorting on fixed numbers of values, in which case they are called sorting networks. (Wikipedia)

sorting_network provided implementations of Batcher's Odd-Even Merge-Sort for sequences of length 2, 4, 8, 16, 32, 64, 128 and 256.

Example of SortingNetwork16:

preview

Usage

let mut items = vec![7, 6, 5, 4, 3, 2, 1, 0];
let network = SortingNetwork16::new();
network.sort(&mut items[..]);
assert_eq!(items, vec![0, 1, 2, 3, 4, 5, 6, 7]);

Contributing

Please read CONTRIBUTING.md for details on our code of conduct,
and the process for submitting pull requests to us.

License

This project is licensed under the MPL-2.0 – see the LICENSE.md file for details.

Commit count: 1

cargo fmt