|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Binary heap implementation using tree structure. More...
#include <htlist.H>#include <tpl_arrayStack.H>#include <tpl_binNode.H>#include <tpl_dynListQueue.H>Go to the source code of this file.
Classes | |
| class | Aleph::BinHeapNode_Data |
| struct | Aleph::BinHeapNode_Data::Control_Fields |
| class | Aleph::BinHeapNode< Key > |
| class | Aleph::BinHeapNodeVtl< Key > |
| class | Aleph::GenBinHeap< NodeType, Key, Compare > |
| Heap genérico de nodos. More... | |
| class | Aleph::GenBinHeap< NodeType, Key, Compare >::Iterator |
| struct | Aleph::BinHeap< Key, Compare > |
| Node heap without virtual destructor. More... | |
| struct | Aleph::BinHeapVtl< Key, Compare > |
| Heap of nodes with virtual destroyer. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
Macros | |
| #define | PREV(p) (p->getL()) |
| #define | NEXT(p) (p->getR()) |
| #define | ULINK(p) reinterpret_cast<Node*&>((p)->getU()) |
| #define | IS_LEAF(p) ((p)->get_control_fields().is_leaf) |
| #define | IS_LEFT(p) ((p)->get_control_fields().is_left) |
| #define | CTRL_BITS(p) ((p)->get_control_fields()) |
Binary heap implementation using tree structure.
This file provides a binary heap implementation that uses a binary tree structure instead of an array. This allows for dynamic sizing and efficient node-based operations.
| Operation | Time |
|---|---|
| insert | O(log n) |
| getMin/getMax | O(1) |
| remove | O(log n) |
| update | O(log n) |
| build from n elements | O(n) |
Use tree-based heap when:
For array-based heaps (more cache-friendly), see:
Definition in file tpl_binHeap.H.
| #define CTRL_BITS | ( | p | ) | ((p)->get_control_fields()) |
Definition at line 146 of file tpl_binHeap.H.
| #define IS_LEAF | ( | p | ) | ((p)->get_control_fields().is_leaf) |
Definition at line 144 of file tpl_binHeap.H.
| #define IS_LEFT | ( | p | ) | ((p)->get_control_fields().is_left) |
Definition at line 145 of file tpl_binHeap.H.
| #define NEXT | ( | p | ) | (p->getR()) |
Definition at line 142 of file tpl_binHeap.H.
| #define PREV | ( | p | ) | (p->getL()) |
Definition at line 141 of file tpl_binHeap.H.
| #define ULINK | ( | p | ) | reinterpret_cast<Node*&>((p)->getU()) |
Definition at line 143 of file tpl_binHeap.H.