BinTree::BinTree()
{ Root = NULL; Cursor = NULL; Size = 0; } void BinTree::InsertAtRoot(TreeData El, int& Success) { if (Root != NULL) Success = False; else { Root = new TreeNode; Root -> Info = El; Root -> Left = NULL; Root -> Right = NULL; Cursor = Root; Size = 1; Success = True; } } void BinTree::InsertLeft(TreeData El, int& Success) { NodePtr OldLeft; if (Cursor == NULL) Success = False; else { OldLeft = Cursor -> Left; Cursor -> Left = new TreeNode; Cursor = Cursor -> Left; Cursor -> Info = El; Cursor -> Right = NULL; Cursor -> Left = OldLeft; Size = Size + 1; Success = True; } }


Return to CIS 350 Index Page