Given the ADT Binary Tree operations as defined in this chapter, what tree of tr
ID: 3536767 • Letter: G
Question
Given the ADT Binary Tree operations as defined in this chapter, what tree of trees does the following sequence of statements produce? Implement with C++ code.
typedef int TreeItemType;
BinaryTree tree1, tree2;
tree2.setRootData(9);
tree2.attachLeft(10);
tree2.attachRight(8);
tree2.getLeftSubTree().attachLeft(2);
tree2.getLeftSubTree().getLeftSubTree().attachLeft(5);
tree2.getLeftSubTree().getLeftSubTree().attachRight(3);
tree2.getRightSubTree().attachLeft(6);
tree2.getRightSubTree().attachRight(7);
tree1.setRootData(1);
tree1.attachLeft(2);
tree1.attachRight(3);
BinaryTree bTree(4, tree2, tree1);