public void CreateChild(int child_weight, int child_value) { FruitNode child = new FruitNode(level + 1, child_weight, value - child_value * child_weight); child.parent = this; children.Add(child); }
public FruitNode(int node_level, int node_weight, int node_value) { level = node_level; weight = node_weight; value = node_value; parent = null; children = new List <FruitNode>(); }
public FruitTree(int root_value, List <int> prices) { root = new FruitNode(0, 0, root_value); current_node = root; leaves = new List <FruitNode>(); levels_price = new List <int>(); foreach (int item in prices) { levels_price.Add(item); } next_node_weight = 0; }