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