What is a Binary Search Tree (BST)?

This lesson will briefly discuss Binary Search Trees and what properties they hold.

Introduction

A Binary Search Tree, also known as an ordered Binary Tree, is a variant of a Binary Tree with a strict condition based on node value.

For all the nodes in a BST, the values of all the nodes in the left sub-tree of the current node are less than or equal to the value of the node itself. All the node values in the right subtree are greater than the value of the current node. This is referred to as the BST rule.

NodeValues(LeftSubtree)<=CurrentNodeValue<NodeValues(RightSubTree)NodeValues(LeftSubtree)<=CurrentNodeValue<NodeValues(RightSubTree)

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.