Public Member Functions | |
ScenTreeStruct (const int nNodes, const int firstL) | |
Constructs the object. | |
virtual | ~ScenTreeStruct () |
virtual int | get_parent (int n) const =0 |
This function returns the parent of a given node (and 0 for the root). | |
Public Attributes | |
int | nmbNodes |
nodes are 0..nmbNodes-1, where 0 is root | |
int | firstLeaf |
nodes firstLeaf..nmbNodes-1 are leaves |
Definition at line 154 of file investment.cpp.
ScenTreeStruct::ScenTreeStruct | ( | const int | nNodes, | |
const int | firstL | |||
) | [inline] |
virtual ScenTreeStruct::~ScenTreeStruct | ( | ) | [inline, virtual] |
Definition at line 163 of file investment.cpp.
virtual int ScenTreeStruct::get_parent | ( | int | n | ) | const [pure 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?
Implemented in BinTreeStruct.
nodes are 0..nmbNodes-1, where 0 is root
Definition at line 156 of file investment.cpp.
Referenced by main().
nodes firstLeaf..nmbNodes-1 are leaves
Definition at line 157 of file investment.cpp.
Referenced by main().