Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions bst.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//Binary tree for C++
#include <bits/stdc++.h>
using namespace std;

class Node {
public:
int data;
Node* left;
Node* right;

// Val is the key or the value that
// has to be added to the data part
Node(int val)
{
data = val;
// Left and right child for node
// will be initialized to null
left = NULL;
right = NULL;
}
};

int main()
{
/*create root*/
Node* root = new Node(1);
root->left = new Node(2);
root->right = new Node(3);
root->left->left = new Node(4);
return 0;
}