#order #slice #rank #indices #array #auxiliary

reorder

Reorder a slice based on a slice of indices

5 stable releases

2.1.3 Mar 26, 2022
2.1.2 Jan 13, 2022
2.0.1 Dec 31, 2021
2.0.0 Apr 14, 2021
1.0.0 Dec 12, 2018

#2 in #auxiliary

Download history 29/week @ 2023-12-19 4/week @ 2023-12-26 1/week @ 2024-01-02 7/week @ 2024-01-09 6/week @ 2024-01-16 27/week @ 2024-02-06 16/week @ 2024-02-13 22/week @ 2024-02-20 143/week @ 2024-02-27 33/week @ 2024-03-05 21/week @ 2024-03-12 30/week @ 2024-03-19 15/week @ 2024-03-26 35/week @ 2024-04-02

106 downloads per month
Used in kayak_ui

MIT/Apache

4KB

Simple crate that will reorder a slice based on a slice of indices without an auxiliary array.

Check it out on crates.io and github and docs.rs.

Example

fn main() {
    
    let (mut arr, mut ind, res) = (
        [50, 40, 70, 60, 90, 10],
        [03, 00, 04, 01, 02, 05],
        [40, 60, 90, 50, 70, 10],
    );
    reorder_index(&mut arr, &mut ind);
    assert_eq!(arr, res);
}

lib.rs:

Simple crate that will reorder a slice based on a slice of indices without an auxiliary array. See https://www.geeksforgeeks.org/reorder-a-array-according-to-given-indexes/

No runtime deps