Deletion
In the lesson, we'll see how to delete a key from a BST.
We'll cover the following
Deletion
While removing a node from a BST, three cases are possible:
- Node is a leaf
- Node has only one child
- Node has two children
In any case, we could end up traversing the entire tree in case of a skewed binary tree. So, the time complexity is .
Node is a leaf
In this case, the node can simply be removed from the tree.
Get hands-on with 1400+ tech skills courses.