CompleteBinaryTree< DataType, StorageStrategy > Class Template Reference

A complete binary tree. More...

#include <completeBinaryTree.h>

List of all members.

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.
NodegetRootPointer () 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.

Detailed Description

template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
class CompleteBinaryTree< DataType, StorageStrategy >

A complete binary tree.

Template Parameters:
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'
Author:
Panos Michail

Constructor & Destructor Documentation

template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
CompleteBinaryTree< DataType, StorageStrategy >::CompleteBinaryTree ( const SizeType &  height = 0,
const DataType &  defaultValue = DataType(0) 
) [inline]

Constructor.

Parameters:
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

Member Function Documentation

template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
const SizeType& CompleteBinaryTree< DataType, StorageStrategy >::getHeight (  )  const [inline]

Returns the height of the tree.

Returns:
The height of the tree
template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
const SizeType& CompleteBinaryTree< DataType, StorageStrategy >::getNumNodes (  )  const [inline]

Returns the number of nodes of the tree.

Returns:
The number of nodes of the tree
template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
Node CompleteBinaryTree< DataType, StorageStrategy >::getRootNode (  )  [inline]

Returns the root node.

Returns:
The root node
template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
Node* CompleteBinaryTree< DataType, StorageStrategy >::getRootPointer (  )  const

Returns a pointer to the root node.

Returns:
A pointer to the root node
template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
void CompleteBinaryTree< DataType, StorageStrategy >::printGraphviz ( std::ostream &  out,
const std::string &  prefix = "" 
) [inline]

Prints the tree in Graphviz format.

Parameters:
out The output stream
prefix An optional prefix to the node names in the Graphviz format

Member Data Documentation

template<typename DataType, template< typename datatype > class StorageStrategy = HeapStorage>
SizeType CompleteBinaryTree< DataType, StorageStrategy >::m_height [protected]

Array that represents the tree and stores the Node data.

The tree height


The documentation for this class was generated from the following file:
Generated on Mon May 21 12:41:03 2012 for Pgl by  doxygen 1.6.3