The Binary Search Tree (BST) is a hierarchical data structure with a single pointer to the root node.

The Node in the BST generally contains "items" (such as numbers or names) for fast look up. Each node has at-most two children (left and right). Every node is organized by some key data field. For every node in BST its key is greater than left child's key and less than right child's key

A typical structure of node (which stores an integer) would be

```
struct bst_node {
int item;
bst_node* left;
bst_node* right;
};
```

There will be only one root node of BST. The root node can be created by

```
bst_node* root = NULL;
root = (bst_node*) malloc(sizeof(bst_node));
```

To set item key of root to 10.

```
root->item = 10;
```

This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0

This website is not affiliated with Stack Overflow