CreateTree(
node*curr,
node*n,
intx,
charpos) {
14cout <<
"\nLeft or Right of "<< n->val <<
" : ";
17CreateTree(n, n->left, x, ch);
19CreateTree(n, n->right, x, ch);
27}
else if(pos ==
'r') {
38 while(!queue.empty()) {
40cout << n->val <<
" ";
44queue.push_back(n->left);
46queue.push_back(n->right);
52cout << n->val <<
" ";
61cout << n->val <<
" ";
70cout << n->val <<
" ";
78cout <<
"\nEnter the value of root node :";
84cout <<
"\n1. Insert";
85cout <<
"\n2. Breadth First";
86cout <<
"\n3. Preorder Depth First";
87cout <<
"\n4. Inorder Depth First";
88cout <<
"\n5. Postorder Depth First";
90cout <<
"\nEnter Your Choice : ";
96cout <<
"\nEnter the value to be Inserted : ";
98cout <<
"\nLeft or Right of Root : ";
101CreateTree(root, root->left, x, pos);
102 else if(pos ==
'r')
103CreateTree(root, root->right, x, pos);
struct node { int data; int height; struct node *left; struct node *right;} node
for std::queue
int main()
Main function.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4