Binary Search Tree is a binary tree in which for each node, value of all the nodes in left subtree is lesser and value of all the nodes in right subtree is greater.
As we can see the root holds the value 15 and the left subtree has a value lesser than 15 (10, 8, 12), the right subtree has a value greater than 15(20, 17, 25). It goes same for the left side of 10 it is 8, it's lesser and the right side value is 12. So we call this a perfect Binary Search Tree.
It user similar concepts to Doubly Linked List because it saves address in the right side and the left of the node.
Comments