Sample Binary Tree Declarations

const True = 1;
const False = 0;

typedef int TreeData;

struct TreeNode
{
  TreeData Info;
  TreeNode *Left;
  TreeNode *Right;
};

typedef struct TreeNode *NodePtr;

typedef void (*FcnType) (TreeData Info);

class BinTree
{
   NodePtr Root, Cursor;
   int Size;
   void DoInOrder(NodePtr Next, FcnType Visit);
 public:
   BinTree();
   int GetSize();
   NodePtr GetRoot();
   NodePtr GetCursor();
   int IsEmpty();
   void InsertAtRoot(TreeData El, int& Success);
   void InsertLeft(TreeData El, int& Success);
   void InsertRight(TreeData El, int& Success);
   void Retrieve(TreeData& El, int& Success);
   void Replace(TreeData& El, int& Success);
   void InitCursor(NodePtr Ptr);
   int HasLeftTree();
   int HasRightTree();
   void GoLeft();
   void GoRight();
   void InOrder(FcnType Visit);
}


Return to CIS 350 Index Page