Tag: Datastructures
Find whether Binary tree is a Binary Search Tree
Property: A binary tree is a Binary Search Tree when all elements to the left is lesser than the current node and the ones to the right are greater than that node. Simplest way to understand is when you print a left node, root and right node, you should get a sorted list based on property …
Read More Find whether Binary tree is a Binary Search TreeHow to delete a node from Binary Search Tree
We must always follow the below 2 points when deleting a node from Binary Search Tree: Delete the node. Retain the Binary Search Tree property. Consider the following scenarios that we encounter when deleting a node from a BST: Scenario 1: Deleting a leaf node or a childless node. This is certainly the easiest case …
Read More How to delete a node from Binary Search Tree