Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
|
#include <red_black_tree_map.h>
Public Member Functions | |
int | size () const |
Returns the number of entries in the map. | |
![]() | |
TreeMap () | |
Creates an empty map. | |
int | size () const |
Returns the number of entries in the map. | |
const_iterator | begin () const |
Returns a const_iterator to first entry. | |
const_iterator | end () const |
Returns a const_iterator representing the end. | |
const_iterator | find (const Key &k) const |
Returns a const_iterator to the entry with a given key, or end() if no such entry exists. | |
const_iterator | put (const Key &k, const Value &v) |
const_iterator | erase (const_iterator loc) |
Removes the entry indicated by the given iterator, and returns const_iterator to next entry in iteration order. | |
const_iterator | lower_bound (const Key &k) const |
Returns a const_iterator to the first entry with key greater than or equal to k, or end() if no such entry exists. | |
const_iterator | upper_bound (const Key &k) const |
Returns a const_iterator to the first entry with key strictly greater than k, or end() if no such entry exists. | |
void | _dump () const |
used for debugging only | |
bool | empty () const |
Returns true if the map is empty, false otherwise. | |
bool | erase (const Key &k) |
virtual const_iterator | erase (const_iterator loc)=0 |
![]() | |
bool | empty () const |
Returns true if the map is empty, false otherwise. | |
bool | contains (const Key &k) const |
Returns true if the map contains an entry with the given key. | |
const Value & | at (const Key &k) const |
bool | erase (const Key &k) |
virtual | ~AbstractMap () |
virtual int | size () const =0 |
virtual const_iterator | begin () const =0 |
virtual const_iterator | end () const =0 |
virtual const_iterator | find (const Key &k) const =0 |
virtual const_iterator | put (const Key &k, const Value &v)=0 |
virtual const_iterator | erase (const_iterator loc)=0 |
Protected Types | |
typedef TreeMap< Key, Value, Compare > | Base |
typedef BalanceableBinaryTree::Node | Node |
![]() | |
typedef dsac::map::AbstractMap< Key, Value > | Base |
typedef std::pair< Entry, int > | BSTEntry |
typedef dsac::tree::LinkedBinaryTree< BSTEntry > | TreeBase |
typedef BalanceableBinaryTree::Node | Node |
typedef BalanceableBinaryTree::Position | Position |
Protected Member Functions | |
void | make_black (Node *p) |
void | make_red (Node *p) |
void | set_color (Node *p, bool to_red) |
bool | is_black (Node *p) const |
bool | is_red (Node *p) const |
bool | is_red_leaf (Node *p) const |
Node * | get_red_child (Node *p) |
Return a red child of p (or nullptr, if no such child) | |
Node * | sibling (Node *p) |
void | resolve_red (Node *p) |
Remedies potential double-red violation above red p. | |
void | rebalance_insert (Node *p) |
void | fix_deficit (Node *z, Node *y) |
void | rebalance_delete (Node *p) |
int | aux (Node *nd) const |
void | set_aux (Node *nd, int value) |
![]() | |
virtual void | rebalance_access (Node *) |
virtual void | rebalance_insert (Node *) |
virtual void | rebalance_delete (Node *) |
Key | key (Node *nd) const |
int | aux (Node *nd) const |
void | set_aux (Node *nd, int value) |
bool | equals (Key a, Key b) const |
Node * | search (Key k) const |
abstract_iter_rep * | get_rep (const_iterator iter) const |
![]() | |
abstract_iter_rep * | get_rep (const_iterator iter) const |
void | update_value (const Entry &e, const Value &v) |
Protected Attributes | |
BalanceableBinaryTree | tree |
![]() | |
BalanceableBinaryTree | tree |
Compare | less_than |
Additional Inherited Members | |
![]() | |
static void | _dumpNode (Node *p) |
static void | _dump (Node *p, int depth) |
![]() | |
static Node * | successor (Node *p) |
|
protected |
|
protected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Return a red child of p (or nullptr, if no such child)
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Remedies potential double-red violation above red p.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlinevirtual |
Returns the number of entries in the map.
Implements dsac::map::AbstractMap< Key, Value >.
|
protected |