Binary Search Tree

Last Updated : 23 Oct, 2026

A Binary Search Tree (BST) is a type of binary tree data structure in which each node contains a unique key and satisfies a specific ordering property:

  • All nodes in the left subtree of a node contain values strictly less than the node’s value.
  • All nodes in the right subtree of a node contain values strictly greater than the node’s value.

This structure enables efficient operations for searching, insertion, and deletion of elements, especially when the tree remains balanced.

Key Properties

  • Unique ordering of elements means duplicates are usually not allowed.
  • Inorder traversal of a BST gives sorted order of elements.
  • Average height: O(log n) (for balanced BST).
  • Worst case height: O(n) (when tree is skewed or forms a line).

Basics

Easy Problems

Medium Problems

Hard Problems

Important Links

Comment