Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Avl_Tree< Key, Compare > Struct Template Reference

AVL binary search tree with nodes without a virtual destructor. More...

#include <tpl_avl.H>

Inheritance diagram for Aleph::Avl_Tree< Key, Compare >:
[legend]
Collaboration diagram for Aleph::Avl_Tree< Key, Compare >:
[legend]

Public Types

using Base = Gen_Avl_Tree< AvlNode, Key, Compare >
 
- Public Types inherited from Aleph::Gen_Avl_Tree< NodeType, Key, Compare >
using Node = NodeType< Key >
 
using key_type = Key
 

Additional Inherited Members

- Public Member Functions inherited from Aleph::Gen_Avl_Tree< NodeType, Key, Compare >
constexpr Compare & key_comp () noexcept
 The key type.
 
constexpr Compare & get_compare () noexcept
 See key_comp().
 
 Gen_Avl_Tree () noexcept(std::is_nothrow_default_constructible_v< Node > and std::is_nothrow_default_constructible_v< Compare > and std::is_nothrow_constructible_v< Compare, Compare & >)
 Builds an empty tree with a comparison criteria built by default.
 
 Gen_Avl_Tree (Compare _cmp) noexcept(std::is_nothrow_default_constructible_v< Node > and std::is_nothrow_constructible_v< Compare, Compare & >)
 Builds an empty tree with the comparison criteria _cmp.
 
 Gen_Avl_Tree (const Gen_Avl_Tree &)=delete
 Not copyable: the tree does not own its nodes, and a copy would hold the same ones.
 
Gen_Avl_Tree & operator= (const Gen_Avl_Tree &)=delete
 Not copyable, for the same reason as the copy constructor.
 
 Gen_Avl_Tree (Gen_Avl_Tree &&tree) noexcept(bin_node_detail::nothrow_header_from_v< Node > and bin_node_detail::nothrow_compare_taken_v< Compare >)
 Takes the nodes and the comparison criteria of tree, which is left empty and can take nodes again.
 
void swap (Gen_Avl_Tree &tree) noexcept(std::is_nothrow_swappable_v< Compare >)
 Swap in constant time all the items of this with the items of tree.
 
virtual ~Gen_Avl_Tree () noexcept=default
 
constexpr Node *& getRoot () noexcept
 Return a modifiable reference to tree's root.
 
constexpr Node * getRoot () const noexcept
 Return a modifiable reference to tree's root.
 
Node * search (const Key &key) const noexcept(nothrow_compare_v< Compare, Key >)
 Search a node containing key.
 
Node * insert (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Insert the node pointed by p in the tree.
 
Node * search_or_insert (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Search or insert a key.
 
Node * insert_dup (Node *p) noexcept(nothrow_compare_v< Compare, Key >)
 Insert the node p without testing for key duplicity.
 
Node * remove (const Key &key) noexcept(nothrow_compare_v< Compare, Key >)
 Remove from an AVL tree the node containing key key.
 
bool verify () const
 Return true if the tree is a valid AVL tree: the balance of every node and the order of the keys.
 

Detailed Description

template<typename Key, class Compare = Aleph::less<Key>>
requires StrictWeakOrder<Compare, Key>
struct Aleph::Avl_Tree< Key, Compare >

AVL binary search tree with nodes without a virtual destructor.

An AVL binary search tree is a binary search tree whose height is bounded by \(O(\lg n)\) and whose update operations are bounded in time by inspecting \(O(\lg n)\) nodes.

This class uses nodes without a virtual destructor.

Template Parameters
Keythe key type stored in the tree nodes.
Comparekey comparison class; by default, this is the less-than relational operator for type Key.
See also
Avl_Tree_Vtl

Definition at line 830 of file tpl_avl.H.

Member Typedef Documentation

◆ Base

template<typename Key , class Compare = Aleph::less<Key>>
using Aleph::Avl_Tree< Key, Compare >::Base = Gen_Avl_Tree<AvlNode, Key, Compare>

Definition at line 832 of file tpl_avl.H.


The documentation for this struct was generated from the following file: