BinTreeStruct Class Reference

Class for balanced binary trees. More...

Inheritance diagram for BinTreeStruct:

Inheritance graph
[legend]
Collaboration diagram for BinTreeStruct:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BinTreeStruct (const int nmbStages)
 Constructs the object - 2^T-1 nodes, first leaf is 2^(T-1)-1.
int get_parent (int n) const
 This function returns the parent of a given node (and 0 for the root).


Detailed Description

Class for balanced binary trees.

Definition at line 173 of file investment.cpp.


Constructor & Destructor Documentation

BinTreeStruct::BinTreeStruct ( const int  nmbStages  )  [inline]

Constructs the object - 2^T-1 nodes, first leaf is 2^(T-1)-1.

Definition at line 176 of file investment.cpp.


Member Function Documentation

int BinTreeStruct::get_parent ( int  n  )  const [inline, virtual]

This function returns the parent of a given node (and 0 for the root).

In a general case, this would be given by a table, for balanced trees one can use a simple formula. The question is what to do with the root: should the function return 0, -1, or throw an exception?

Implements ScenTreeStruct.

Definition at line 179 of file investment.cpp.

Referenced by main().


The documentation for this class was generated from the following file:
Generated on Mon Jan 26 10:53:07 2009 for investment by  doxygen 1.5.4