MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/BST/InsertionInABST.cpp:59–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58
59int main() {
60 struct node *root = NULL;
61 int ch;
62 int x;
63 cout<<"Press 0 to exit else enter 1: ";
64 cin>>ch;
65 while(ch!=0)
66 {
67 cout<<"\n"<<"1.Insertion"<<"\n"<<"2.View"<<"\n";
68 cout<<"\n"<<"Enter choice :";
69 cin>>ch;
70 switch (ch)
71 {
72 case 1:
73 cout<<"Enter the value you want to insert in binary search tree: ";
74 cin>>x;
75 root = insert(root, x);
76 break;
77 case 2:
78 cout << "Inorder traversal: ";
79 inorder(root);
80 break;
81
82 default:
83 printf("\nINVALID CHOICE !!");
84 break;
85 }
86 }
87return 0;
88
89
90}

Callers

nothing calls this directly

Calls 2

insertFunction · 0.70
inorderFunction · 0.70

Tested by

no test coverage detected