// Chap 10, p463
#include // must precede for defn of NULL
#include "BT.h" // binary tree operations
void Display(treeItemType& AnItem)
{ cout << AnItem << " ";
} // end Display
main()
{
binTreeClass T1, T2, L; // empty trees
binTreeClass T3(70); // one-node tree with root 70
boolean Success;
// build the tree in Figure 10-9
T1.SetRootData(40);
T1.AttachLeft(30, Success);
T1.AttachRight(50, Success);
T2.SetRootData(20);
T2.AttachLeft(10, Success);
T2.AttachRightSubtree(T1, Success);
binTreeClass T(60, T2, T3);
cout << "Inorder traverse: ";
T.InorderTraverse(&Display);
cout << "\nInorder traverse of root's left subtree: ";
T.LeftSubtree().InorderTraverse(&Display);
cout << endl;
T.DetachLeftSubtree(L, Success);
cout << "Inorder traverse of left detached subtree: ";
L.InorderTraverse(&Display);
cout << "\nInorder traverse of orig tree: ";
T.InorderTraverse(&Display);
cout << endl;
return 0;
}
               (
geocities.com/siliconvalley/program/2864/ds)                   (
geocities.com/siliconvalley/program/2864)                   (
geocities.com/siliconvalley/program)                   (
geocities.com/siliconvalley)