✅ What is a BST (Binary Search Tree)?

A Binary Search Tree is a type of binary tree with these key rules:

🌳 Properties of a BST:

  1. Each node has at most two children.
  2. Left child has value less than the node.
  3. Right child has value greater than the node.
  4. This rule is recursively true for all subtrees.

📈 Example:

markdown
CopyEdit
        8
       / \
      3   10
     / \    \
    1   6    14
       / \   /
      4   7 13


✅ What Can a BST Do?

BST is used for fast search, insert, and delete operations.

Operation Time (Average Case) Time (Worst Case – Skewed Tree)
Search O(log n) O(n)
Insert O(log n) O(n)
Delete O(log n) O(n)

In balanced BSTs (like AVL or Red-Black Tree), operations are guaranteed O(log n).


✅ What is an Ordered Set?

An ordered set is a data structure that:

  1. Stores elements in sorted order