void BST::Insert(TreeData El, int& Success) { TreeData Current; if (IsEmpty()) InsertAtRoot(El, Success); else { Search(El, Success); if (Success) // no duplications Success = False; else { Retrieve(Current, Success); if (El < Current) InsertLeft(El, Success); else InsertRight(El, Success); } } void BST::Search(TreeData El, int& Success) { InitCursor(GetRoot()); DoSearch(El, Success); } void BST::DoSearch(TreeData El, int& Success) { TreeData Current; Retrieve (Current, Success); if (!Success) Success = False; else if (Current == El) Success = True; else if (Current < El) { if (!HasRightTree()) Success = False; else { GoRight(); DoSearch(El, Success); } } }