logo
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

Performs the conversion.

Performs the conversion.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

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.