forked from Mehr-un-nisa/cpp-data-structures
-
Notifications
You must be signed in to change notification settings - Fork 1
/
BinaryTree
69 lines (47 loc) · 1.1 KB
/
BinaryTree
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//////////////////IMPLEMENTATION FILE OF BINARY TREE CLASS////////////////////////
#ifndef binTree_h
#define binTree_h
#include "Node.h"
using namespace std;
class binTree{
int count;
public:
Cnode *root;
//NULL CONSTRUCTOR
binTree();
//PARAMETRIC CONSTRUCTOR
binTree(Cnode*&ptr);
//FUNCTION TO INSERT NODE
binTree& insert(Cnode *&ptr);
//PRINT PREORDER
void printPreorder();
//PRINT POSTORDER
void printInorder();
//PRINT POSTORDER
void printPostorder();
//DESTRUCTOR
~binTree();
//PRINT REVERSE
void printReverse();
//GET MINIMUM KEY NODE
int minValue(Cnode *node);
//GET MAXIMUM KEY NODE
int maxValue(Cnode *node);
//TO CHECK IF TREE IS EMPTY OR NOT
bool isEmpty();
//TO CHECK F TREE IS NOT EMPTY OR NOT
bool isNotEmpty();
//GET COUNT FUNCTION
int getCount();
//PRINT COUNT
void printCount();
//FUNCTION TO SEARCH NODE
bool searchNode(Cnode *node,int key);
//FUNCTION TO DELETE NODE
Cnode* deleteNode(Cnode *currentNode, int value);
//GET LEVEL OF TREENODE
int levelOfTree(Cnode * node);
////COUNT TOTAL NODES IN TREE
int totalTreeNodes(Cnode *node);
};
#endif