DS3: Binary Search Trees

San Skulrattanakulchai

September 20, 2018

Dynamic Sets

Dynamic Set Operations

Binary Search Trees

BST Algorithms

maximum, minimum, predecessor, successor

Insert

Delete

  1. if z has no children, replace z in T by NIL;
  2. if z has exactly one child x, replace z in T by x;
  3. if z has two children, letting y be the successor of z in T, letting \(\alpha\) be the left subtree of z, and letting \(\beta\) be the right subtree of z but having the subtree rooted at y transplanted by the right subtree of y, transplant the tree rooted at z by the tree (y, \(\alpha\), \(\beta\)).