DSA Lab Projects Group One
DSA Lab Projects Group One
Student Name ID No
#include <iostream>
class Node {
public:
int key;
Node* left;
Node* right;
Node(int key) {
this->key = key;
left = nullptr;
right = nullptr;
}
};
int main() {
Node* root = nullptr;
root = insert(root, 50);
root = insert(root, 30);
root = insert(root, 20);
root = insert(root, 40);
root = insert(root, 70);
root = insert(root, 60);
root = insert(root, 80);
cout << "Inorder traversal of the binary search tree:" << endl;
inorderTraversal(root);
return 0;
}