Tree tree tree addNewNode new Node tree addNewNode new Node tree addNe

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Tree tree;
tree.addNewNode(new Node("a", 1));
tree.addNewNode(new Node("b", 2));
tree.addNewNode(new Node("+", 3));
tree.setParentByNodeIndex(1, 3);
tree.setParentByNodeIndex(2, 3);
tree.addNewNode(new Node("c", 5));
tree.addNewNode(new Node("d", 6));
tree.addNewNode(new Node("e", 7));
tree.addNewNode(new Node("-", 8));
tree.addNewNode(new Node("*", 9));
tree.addNewNode(new Node("+", 10));
tree.setParentByNodeIndex(6, 8);
tree.setParentByNodeIndex(7, 8);
tree.setParentByNodeIndex(5, 9);
tree.setParentByNodeIndex(8, 9);
tree.setParentByNodeIndex(3, 10);
tree.setParentByNodeIndex(8, 10);
tree.notacjaPolska();
cout << "Польская запись: " << tree.Result() << endl;