b-tree-plus-alpha
|
A dynamic data structure supporting prefix-sum query. More...
#include <dynamic_prefix_sum.hpp>
Public Types | |
using | NodePointer = bptree::BPNodePointer< LEAF_CONTAINER, uint64_t, TREE_DEGREE > |
using | Tree = bptree::BPTree< LEAF_CONTAINER, uint64_t, false, true, TREE_DEGREE, LEAF_CONTAINER_MAX_SIZE > |
Public Member Functions | |
DynamicPrefixSum (const std::vector< uint64_t > &items) | |
DynamicPrefixSum & | operator= (const DynamicPrefixSum &)=delete |
DynamicPrefixSum (DynamicPrefixSum &&) noexcept=default | |
DynamicPrefixSum & | operator= (DynamicPrefixSum &&) noexcept=default |
Iterators | |
The iterators supported this data structure. | |
Tree::ValueForwardIterator | begin () const |
Tree::ValueForwardIterator | end () const |
Properties | |
The properties of this class. | |
Tree & | __get_tree () |
Get the internal tree of this data structure. | |
uint64_t | get_degree () const |
Get the maximum degree of internal nodes of the internal tree of this data structure. | |
uint64_t | size () const |
Return the number of elements stored in this data structure. | |
uint64_t | at (uint64_t pos) const |
Return the element at the given position. | |
uint64_t | size_in_bytes () const |
Return the size of this data structure in bytes. | |
Conversion functions | |
The conversion functions supported this data structure. | |
std::vector< uint64_t > | to_vector () const |
Return the elements stored in this data structure as a vector. | |
std::vector< uint8_t > | to_u8_vector () const |
Return the elements stored in this data structure as a vector of uint8_t. | |
std::string | to_string () const |
Queries | |
The queries supported this data structure. | |
uint64_t | psum (uint64_t i) const |
Return the sum of the first i values stored in this data structure. | |
uint64_t | psum () const |
Return the sum of the stored values. | |
int64_t | search (uint64_t x) const |
Return the smallest i such that psum(i) >= x. | |
int64_t | predecessor_index (uint64_t value) const |
int64_t | successor_index (uint64_t value) const |
uint64_t | operator[] (uint64_t n) const |
Update operations | |
The update operations supported this data structure. | |
void | swap (DynamicPrefixSum &item) |
void | clear () |
Clear the elements stored in this data structure. | |
void | verify () const |
Verify the internal consistency of this data structure. | |
void | push_back (uint64_t value) |
void | push_front (uint64_t value) |
void | pop_back () |
void | pop_front () |
void | insert (uint64_t pos, uint64_t value) |
void | remove (uint64_t pos) |
void | increment (uint64_t i, int64_t delta) |
void | decrement (uint64_t i, int64_t delta) |
void | push_many (const std::vector< uint64_t > &items) |
void | set_value (uint64_t i, uint64_t value) |
double | density () const |
Print functions | |
The functions for printing messages. | |
std::vector< std::string > | get_memory_usage_info (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
void | print_memory_usage (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
void | print_statistics (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
void | print_information_about_performance (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
void | print_tree (int message_paragraph=stool::Message::SHOW_MESSAGE) const |
Static Public Member Functions | |
Builder and Writer functions | |
The functions for building and writing this data structure. | |
static DynamicPrefixSum | build (const std::vector< uint64_t > &items) |
static DynamicPrefixSum | build_from_data (const std::vector< uint8_t > &data, uint64_t &pos) |
static DynamicPrefixSum | build_from_data (std::ifstream &ifs) |
static void | save (DynamicPrefixSum &item, std::vector< uint8_t > &output, uint64_t &pos) |
static void | save (DynamicPrefixSum &item, std::ofstream &os) |
Other static functions | |
The other static functions supported this data structure. | |
static std::string | name () |
A dynamic data structure supporting prefix-sum query.
|
inline |
Get the internal tree of this data structure.
|
inline |
Return the element at the given position.
pos | The position of the element to return. |
|
inline |
Get the maximum degree of internal nodes of the internal tree of this data structure.
|
inline |
Return the number of elements stored in this data structure.
|
inline |
Return the size of this data structure in bytes.
|
inline |
Return the elements stored in this data structure as a vector of uint8_t.
|
inline |
Return the elements stored in this data structure as a vector.