pub struct RankSelect { /* private fields */ }
Expand description

A rank/select data structure.

Implementations

Create a new instance.

Arguments
  • bits - A bit vector.
  • k - Determines the size (k * 32 bits) of the superblocks. A small k means faster rank query times at the expense of using more space and slower select query times. The data structure needs O(n + n log n / (k * 32)) bits with n being the bits of the given bitvector. The data structure is succinct if k is chosen as a sublinear function of n (e.g. k = (log n)² / 32).

Return the used k (see RankSelect::new()).

Get internal representation of bit vector.

Return i-th bit.

Get the 1-rank of a given bit, i.e. the number of 1-bits in the bitvector up to i (inclusive). Complexity: O(k).

Arguments
  • i - Position of the bit to determine the rank for.

Get the 0-rank of a given bit, i.e. the number of 0-bits in the bitvector up to i (inclusive). Complexity: O(k).

Arguments
  • i - Position of the bit to determine the rank for.

Alias for RankSelect::rank_1.

Get the smallest bit with a given 1-rank. Complexity: O(log (n / k) + k).

Arguments
  • j - The rank to find the smallest bit for.

Get the smallest bit with a given 0-rank. Complexity: O(log (n / k) + k).

Arguments
  • j - The rank to find the smallest bit for.

Alias for RankSelect::select_1.

Trait Implementations

Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.