Template Class AVLTree

Nested Relationships

Nested Types

Class Documentation

template<std::totally_ordered K, class V>
class AVLTree

a DICTIONARY on an AVL tree

Public Types

using Key = K

the type of the keys

using Value = V

the type of the values

using value_type = std::pair<const K&, const V&>
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = value_type
using const_reference = value_type
using const_iterator = PathIterator<AVLTree, Shape>
using iterator = const_iterator

Public Functions

std::optional<V> lookup(const K &k) const

the value of k, or nothing

void insert(const K &k, const V &v)

associates v to k

Post:

k has the value v

void remove(const K &k)

removes k, if it is there

Post:

k is not there

bool contains(const K &k) const
std::size_t size(void) const
bool empty(void) const
int height(void) const

the height of the tree, -1 if it is empty

template<class F>
void forEach(F &&f) const

f( k , v ) on the pairs by increasing keys

inline const_iterator begin(void) const
inline const_iterator end(void) const
inline const_iterator cbegin(void) const
inline const_iterator cend(void) const
struct Shape

the shape of the tree, for PathIterator

Public Static Functions

static inline auto root(const auto &o)
static inline auto left(const auto *n)
static inline auto right(const auto *n)
static inline auto read(const auto *n)