Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
BinTree Class Reference

#include <elm/inhstruct/BinTree.h>

+ Inheritance diagram for BinTree:

Classes

class  Node
 
class  Visitor
 

Public Member Functions

 BinTree (void)
 
bool isEmpty (void) const
 
bool contains (Node *node)
 
int count (void) const
 
Noderoot (void) const
 
void setRoot (Node *node)
 
void visit (Visitor *visitor) const
 
void visitPreOrder (Visitor *visitor) const
 
void visitPostOrder (Visitor *visitor) const
 
void search (Visitor *visitor) const
 
void clear (void)
 

Detailed Description

Provide a binary tree implementation. For being used, the pure virtual method compare() must be defined inan extended class.

Constructor & Destructor Documentation

◆ BinTree()

BinTree ( void  )
inline

Member Function Documentation

◆ clear()

void clear ( void  )
inline

Remove all nodes from the tree.

Referenced by SortedBinTree::clear().

◆ contains()

bool contains ( Node node)
inline

Check if node if the node is contained in the tree.

Parameters
nodeNode to find.
Returns
True if the node is found, false else.

◆ count()

int count ( void  ) const
inline

Count the number of nodes in the tree.

Returns
Count of nodes in the tree.

Referenced by SortedBinTree::count().

◆ isEmpty()

◆ root()

◆ search()

void search ( Visitor visitor) const

◆ setRoot()

◆ visit()

void visit ( BinTree::Visitor visitor) const
inline

Visit the tree in-order, that is, the left sub-tree, the root node and the right sub-tree.

Parameters
visitorObject called for each node in the graph.

◆ visitPostOrder()

void visitPostOrder ( BinTree::Visitor visitor) const
inline

Visit the tree in post-order, that is, the left sub-tree and then, right sub-tree and the root node.

Parameters
visitorObject called for each node in the graph.

◆ visitPreOrder()

void visitPreOrder ( BinTree::Visitor visitor) const
inline

Visit the tree in pre-order, that is, visit node, the left sub-tree and then the right sub-tree.

Parameters
visitorObject called for each node in the graph.

The documentation for this class was generated from the following files: