There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. C.A.R. Hoare

Binary search tree

Language Java | Level Intermediate | Category Algorithms | August 2, 2015 6:25 pm

Algorithm Problem Description

A binary search tree is a binary tree (contains only two nodes). The left subtree node data value is less than or equal to parent node data value and right subtree node data value is greater than or equal to parent node data value.

Each node has a unique key which helps to identify the node. The binary search tree supports search, insert and delete the node. It increases memory dynamically.


The Binary search tree supports inorder, preorder and post order traversal.

In-order traversal

Inorder traversal traverse left subtree, display the data and traverse the right subtree. It always gives a sorted sequence of the values

Pre-order traversal

Pre order displays the data, traverse left subtree and traverse the right subtree

Post-order traversal

Post order traverse left subtree, traverse the right subtree and display the data


Binary search Tree can use recursive or iterative search. Search operation takes time proportional to the tree's height.


All Binary Tree Values: 1 2 3 4 5  
Value '4' found from given tree!
Value '11' not found from given tree!



Please login to add comments.