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). |
Definition at line 173 of file investment.cpp.
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.
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().