To go through the C program / source-code, scroll down this page
Binary Search Tree:
A tree is a connected, acyclic, unidirectional graph. It emulates a tree structure with a set of linked nodes. The topmost node in a tree is called the root node, node of a tree that has child nodes is called an internal node or inner node and the bottom most nodes are called a leaf node. The root is a node that has no parent; it can have only child nodes. Leaves, on the other hand, have no children. The simplest form of a tree is a Binary Tree which has a root node and two subtrees (which is a portion of a tree data structure that can be viewed as a complete tree in itself) - left and right. A Binary Search Tree is a binary tree in which if a node has value N, all values in its left sub-tree are less than N, and all values in its right sub-tree are greater than N. This property called binary search tree property holds for each and every node in the tree.
Basic operations of Binary Search tree are:
Finding a node with a specific data value.
Finding a node with minimum or maximum data value.
Insertion and deletion of a node.
Three (preorder, postorder and inorder) operations for depth-first traversal of a tree
Visit a node before traversing it’s sub-trees
Visit a node after traversing it’s left subtree but before traversing it’s right sub-tree
Visit a node after traversing all of it’s subtrees
Binary search tree has three properties: data stands for the value of the node, *left is the left subtree of a node and *right (a pointer of type struct treeNode) is the right subtree of a node.
Complete Tutorial with Examples :