Skip to content

A dynamic bitvector that supports rank and select queries

License

Notifications You must be signed in to change notification settings

zMoooooritz/ditvector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ditvector

A dynamic bitvector that support rank and select queries.

The datastructure allows for one template argument that defines the size of the bitblocks stored in the leafs. This parameter can be used to select the appropriate trade-off between space and time complexity. As a sensible default a size of 512 bits is used.

Operations

The datastructure supports the following instructions which all have logarithmic runtime.

  • insert(index, true/false)
  • del(index)
  • set(index)
  • unset(index)
  • flip(index)
  • rank(index, true/false)
  • select(index, true/false)
  • complement()
  • size() returns number of bits in bitvector
  • extract() returns all bits as std::vector

Usage

BitVector<16> bv;
bv.insert(0, false);
bv.insert(0, true);
bv.access(0);         // 1
bv.rank(1, true);     // 1
bv.flip(0);
bv.rank(1, true);     // 0

About

A dynamic bitvector that supports rank and select queries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published