What is Binary Search Tree

Mujahida Joynab - Feb 14 - - Dev Community

It is a combination of
Binary Search + Binary Tree

A binary tree where we can do binary search .
It can have maximum 2 child .

What is binary search ?
At start point we see if the value is equal to the mid value . If the value is greater than the mid value we used to search at right . Else at left if it is less then the mid value .

We follow two condition -

  1. All values of left sub tree < node-> val
  2. All values of right sub tree > node->val

Example -
Image description

Here all values of left nodes from root are less than the root and right side value from the root are greater than the root .

So , The left sub tree have to be less than the root node
and the right sub tree have to be greater than the root node .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .