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 |
Get the parent of a given node. |
Definition at line 240 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 243 of file investment.cpp.
int BinTreeStruct::get_parent | ( | int | n | ) | const [inline, virtual] |
Get the parent of a given node.
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 246 of file investment.cpp.
Referenced by main().