A complete binary tree. More...
#include <completeBinaryTree.h>
Classes | |
| class | Node |
| A node iterator of a CompleteBinaryTree. More... | |
Public Member Functions | |
| CompleteBinaryTree (const SizeType &height=0, const DataType &defaultValue=DataType(0)) | |
| Constructor. | |
| ~CompleteBinaryTree () | |
| Destructor. | |
| void | decreaseHeight () |
| Remove the last level of the tree. | |
| const SizeType & | getHeight () const |
| Returns the height of the tree. | |
| const SizeType & | getNumNodes () const |
| Returns the number of nodes of the tree. | |
| Node | getRootNode () |
| Returns the root node. | |
| Node * | getRootPointer () const |
| Returns a pointer to the root node. | |
| void | increaseHeight () |
| Add one more level to the tree. | |
| void | printGraphviz (std::ostream &out, const std::string &prefix="") |
| Prints the tree in Graphviz format. | |
Protected Attributes | |
| DataType * | m_pool |
| Array that represents the tree and stores the node data. | |
| SizeType | m_height |
| Array that represents the tree and stores the Node data. | |
| SizeType | m_numNodes |
| The number of nodes in the tree. | |
| DataType | m_defaultValue |
| The default data for nodes. | |
| StorageScheme * | m_storage |
| The storage scheme item. | |
A complete binary tree.
| DataType | The data to associate with the nodes. It must be a class or struct | |
| StorageStrategy | The underlying storage implementation to use. Available implementations are 'HeapStorage', 'ExplicitHeapStorage', 'VebStorage', 'ExplicitVebStorage', 'ExplicitPowerVebStorage' and 'SplitStorage' |
| CompleteBinaryTree< DataType, StorageStrategy >::CompleteBinaryTree | ( | const SizeType & | height = 0, |
|
| const DataType & | defaultValue = DataType(0) | |||
| ) | [inline] |
Constructor.
| height | The tree height ( maximum distance from root, i.e. a tree with one node has height=0) | |
| defaultValue | The default value to initiallize the nodes' data |
| const SizeType& CompleteBinaryTree< DataType, StorageStrategy >::getHeight | ( | ) | const [inline] |
Returns the height of the tree.
| const SizeType& CompleteBinaryTree< DataType, StorageStrategy >::getNumNodes | ( | ) | const [inline] |
Returns the number of nodes of the tree.
| Node CompleteBinaryTree< DataType, StorageStrategy >::getRootNode | ( | ) | [inline] |
Returns the root node.
| Node* CompleteBinaryTree< DataType, StorageStrategy >::getRootPointer | ( | ) | const |
Returns a pointer to the root node.
| void CompleteBinaryTree< DataType, StorageStrategy >::printGraphviz | ( | std::ostream & | out, | |
| const std::string & | prefix = "" | |||
| ) | [inline] |
Prints the tree in Graphviz format.
| out | The output stream | |
| prefix | An optional prefix to the node names in the Graphviz format |
SizeType CompleteBinaryTree< DataType, StorageStrategy >::m_height [protected] |
Array that represents the tree and stores the Node data.
The tree height
1.6.3