Binary Search Tree
Binary Search Tree
Dr. D. P. Acharjya
Professor, SCOPE
30-Mar-17 Dr. D. P. Acharjya 1
Binary Search Trees
A binary tree T is termed as binary search
tree if each node N of T satisfies the
following properties.
The value at N is greater than every value in the
left sub-tree.
The value at N is smaller than every value in the
right sub-tree.
A special kind of binary tree which is an
efficient structure to organize data for quick
search as well as quick update.
Case 3 20 45 Case 2
16 29 42
24 33
27 Case 1
35 35
20 45 20 45
16 29 42 16 29 42
24 33 24 33
35 35
20 45 20 42
16 29 42 16 29
24 33 24 33
35 35
20 45 24 45
16 29 42 16 29 42
24 33 27 33
27
1. ptr1=ptr.Rchild
2. If (ptr1 Null)
3. while (ptr1.Lchild Null) do
Algorithm for SUCC(ptr)
4. ptr1=ptr1.Lchild
5. End while
6. Endif
7. Return ptr of inorder successor