-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbst.h
More file actions
31 lines (28 loc) · 688 Bytes
/
bst.h
File metadata and controls
31 lines (28 loc) · 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class BST
{
private:
struct node
{
int key;
node *left;
node *right;
};
node *root;
void AddLeafPrivate(int key, node *ptr);
void PrintInOrderPrivate(node *ptr);
node *ReturnNodePrivate(int key, node *ptr);
int FindSmallestPrivate(node *ptr);
void RemoveNodePrivate(int key, node *parent);
void RemoveRootMatch();
void RemoveMatch(node *parent, node *match, bool left);
public:
BST();
node *CreateLeaf(int key);
void AddLeaf(int key);
void PrintInOrder();
node *ReturnNode(int key);
int ReturnRootKey();
void PrintChildren(int key);
int FindSmallest();
void RemoveNode(int key);
};