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

Heap of nodes with virtual destroyer. More...

#include <tpl_binHeap.H>

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

Public Types

using Node = BinHeapNodeVtl< Key >
 The heap's node type.
 
- Public Types inherited from Aleph::GenBinHeap< NodeType, Key, Compare >
using Node = NodeType< Key >
 

Additional Inherited Members

- Public Member Functions inherited from Aleph::GenBinHeap< NodeType, Key, Compare >
Compare & key_comp () noexcept
 
Compare & get_compare () noexcept
 
void swap (GenBinHeap &h) noexcept
 
Node * getRoot () noexcept
 
Node * getRoot () const noexcept
 
template<class Operation >
bool preorder_traverse (Operation op) const
 
template<class Operation >
void for_each_in_preorder (Operation &operation) const
 
template<class Operation >
void for_each_in_preorder (Operation &&operation=Operation()) const
 
template<class Operation >
void for_each_in_inorder (Operation &operation) const
 
template<class Operation >
void for_each_in_inorder (Operation &&operation=Operation()) const
 
template<class Op >
bool level_traverse (Op operation=Op()) const
 
 GenBinHeap (Compare __cmp=Compare()) noexcept
 
virtual ~GenBinHeap () noexcept
 
Node * insert (Node *p) noexcept
 Inserts a node into a heap.
 
Node * getMin_ne () noexcept
 
Node * getMin ()
 Removes the node with the lowest priority from the heap.
 
Node * getMax ()
 
void update (Node *p) noexcept
 Updates the priority of a node contained in the heap.
 
Node * remove (Node *node)
 Removes node from the heap.
 
void remove_all_and_delete () noexcept
 Deletes all the nodes of the heap, invokes the destructors of the removed nodes, and frees all the memory.
 
Node * top ()
 Returns the node with the lowest priority according to the comparison criterion specified in the declaration.
 
Node * top () const
 
const size_t & size () const noexcept
 
bool is_empty () const noexcept
 
bool verify_heap () const
 
- Protected Member Functions inherited from Aleph::GenBinHeap< NodeType, Key, Compare >
virtual bool verify_heap (Node *p) const
 
- Static Protected Member Functions inherited from Aleph::GenBinHeap< NodeType, Key, Compare >
static Node * advance_left (Node *p) noexcept
 
static Node * advance_right (Node *p) noexcept
 
- Protected Attributes inherited from Aleph::GenBinHeap< NodeType, Key, Compare >
Compare cmp
 

Detailed Description

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

Heap of nodes with virtual destroyer.

The BinHeapVtl class instruments a node heap with a destroyer virtual. This team doesn't is implemented by array, but with a binary tree. This provides the great advantage of being highly dynamic. The memory used is therefore proportional to the amount of nodes of the HEAP.

Parameters
Keythe key that each node keeps.
Comparethe criterion of comparison between the keys of the Nodes; by default is the relationship "less than".
See also
BinHeap DynBinHeap

Definition at line 1032 of file tpl_binHeap.H.

Member Typedef Documentation

◆ Node

template<class Key , typename Compare = Aleph::less<Key>>
using Aleph::BinHeapVtl< Key, Compare >::Node = BinHeapNodeVtl<Key>

The heap's node type.

Definition at line 1035 of file tpl_binHeap.H.


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