pub struct DArray { /* private fields */ }
Expand description
Constant-time select data structure over integer sets with the dense array technique by Okanohara and Sadakane.
This is a yet another Rust port of succinct::darray.
Examples
use sucds::DArray;
let da = DArray::from_bits(&[true, false, false, true]);
assert_eq!(da.select(0), 0);
assert_eq!(da.select(1), 3);
let mut bytes = vec![];
let size = da.serialize_into(&mut bytes).unwrap();
let other = DArray::deserialize_from(&bytes[..]).unwrap();
assert_eq!(da, other);
assert_eq!(size, bytes.len());
assert_eq!(size, da.size_in_bytes());
References
- D. Okanohara, and K. Sadakane, “Practical Entropy-Compressed Rank/Select Dictionary,” In ALENEX, 2007.
Implementations
Serializes the data structure into the writer, returning the number of serialized bytes.
Arguments
writer
:std::io::Write
variable.
Returns the number of bytes to serialize the data structure.
Searches the k
-th iteger.
Arguments
k
: Select query.
Complexity
- Constant
Examples
use sucds::DArray;
let da = DArray::from_bits(&[true, false, false, true]);
assert_eq!(da.select(0), 0);
assert_eq!(da.select(1), 3);
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for DArray
impl UnwindSafe for DArray
Blanket Implementations
Mutably borrows from an owned value. Read more