107using namespace Aleph;
142# define PREV(p) (p->getL())
143# define NEXT(p) (p->getR())
144# define ULINK(p) reinterpret_cast<Node*&>((p)->getU())
145# define IS_LEAF(p) ((p)->get_control_fields().is_leaf)
146# define IS_LEFT(p) ((p)->get_control_fields().is_left)
147# define CTRL_BITS(p) ((p)->get_control_fields())
171 template <
template <
class>
class NodeType,
typename Key,
196 std::swap(
root,
h.root);
197 std::swap(
last,
h.last);
199 std::swap(
cmp,
h.cmp);
468 ULINK(new_node) = parent;
469 LLINK(new_node) = left_child;
470 RLINK(new_node) = right_child;
476 LLINK(parent) = new_node;
481 RLINK(parent) = new_node;
487 RLINK(left_child) = new_node;
488 LLINK(right_child) = new_node;
492 ULINK(left_child) = new_node;
494 if (
ULINK(right_child) == node)
495 ULINK(right_child) = new_node;
499 RLINK(left_child) = new_node;
500 LLINK(right_child) = new_node;
529 template <
class Operation>
541 template <
class Operation>
553 template <
class Operation>
566 template <
class Operation>
572 template <
class Operation>
578 template <
class Operation>
584 template <
class Operation>
590 template <
class Operation>
858 if (left_link ==
nullptr)
868 if (right_link ==
nullptr)
1004 template <
class Key,
typename Compare = Aleph::less<Key>>
1030 template <
class Key,
typename Compare = Aleph::less<Key>>
C++20 concepts hub: comparison, BST policy, and Aleph container concepts.
#define ah_underflow_error_if(C)
Throws std::underflow_error if condition holds.
#define ah_overflow_error_if(C)
Throws std::overflow_error if condition holds.
BinHeapNode_Data() noexcept
BinHeapNode_Data *& getU() noexcept
Control_Fields control_fields
Control_Fields & get_control_fields() noexcept
Dynamic queue of elements of generic type T based on single linked list.
T & put(const T &data)
The type of element.
T get()
Remove the oldest item of the queue.
bool is_empty() const noexcept
Return true if this is empty.
bool is_empty() const noexcept
Return true if stack is empty.
T pop() noexcept
Pop by moving the top of stack.
void empty() noexcept
Empty the stack.
T & push(const T &data) noexcept(std::is_nothrow_copy_assignable_v< T >)
Push a copy of data
Iterator() noexcept
Default constructor creates an "end" iterator.
Node * get_curr_ne() const noexcept
bool has_curr() const noexcept
void reset_first() noexcept
Iterator(const GenBinHeap &h)
static const size_t Stack_Size
void reset_last() noexcept
size_t get_pos() const noexcept
bool preorder_traverse(Operation op) const
Node * getRoot() noexcept
bool preorder_traverse(Node *p, Operation op) const
Compare & get_compare() noexcept
void update(Node *p) noexcept
Updates the priority of a node contained in the heap.
virtual bool verify_heap(Node *p) const
bool is_empty() const noexcept
static Node * advance_left(Node *p) noexcept
void for_each_in_preorder(Operation &&operation=Operation()) const
Node * getMin()
Removes the node with the lowest priority from the heap.
static bool is_in_list(Node *p) noexcept
Node * getRoot() const noexcept
Node * remove(Node *node)
Removes node from the heap.
void for_each_in_inorder(Operation &operation) const
void swap_with_parent(Node *p) noexcept
virtual ~GenBinHeap() noexcept
static Node * advance_right(Node *p) noexcept
void remove_all_and_delete() noexcept
Deletes all the nodes of the heap, invokes the destructors of the removed nodes, and frees all the me...
bool level_traverse(Op operation=Op()) const
void replace_node(Node *node, Node *new_node) noexcept
GenBinHeap(Compare __cmp=Compare()) noexcept
static void __for_each_in_inorder(Node *p, Operation &operation)
virtual void sift_up(Node *p) noexcept
Node * getMin_ne() noexcept
virtual void sift_down(Node *p) noexcept
void swap(GenBinHeap &h) noexcept
void for_each_in_preorder(Operation &operation) const
void swap_root_with_last() noexcept
Compare & key_comp() noexcept
static void __for_each_in_preorder(Node *p, Operation &operation)
static void __postorder_delete(Node *p, Node *incomplete_node) noexcept
Node * insert(Node *p) noexcept
Inserts a node into a heap.
Node * top()
Returns the node with the lowest priority according to the comparison criterion specified in the decl...
void for_each_in_inorder(Operation &&operation=Operation()) const
static bool has_sibling(Node *p) noexcept
const size_t & size() const noexcept
bool __level_traverse(Node *root, Op &operation) const
Node * remove_last() noexcept
Strict weak ordering constraint for BST comparators.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
#define DECLARE_BINNODE(Name, height, Control_Data)
Specify tree node for a binary tree.
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
Heap of nodes with virtual destroyer.
Node heap without virtual destructor.
Stack implementations backed by dynamic or fixed arrays.
Basic binary tree node definitions.
Dynamic queue implementation based on linked lists.