In this post, we will see how to check if a given binary tree is a binary search tree or not. This is one of important interview questions on the binary tree.
We will see two approaches to check if binary tree is bst or not.
In this post, we will see how to check if a given binary tree is a binary search tree or not. This is one of important interview questions on the binary tree.
We will see two approaches to check if binary tree is bst or not.
In this post, we will see how to convert sorted LinkedList to a balanced binary search tree.
You might know that inorder traversal of binary search tree results in sorted array. We will use this property to convert sorted array to balanced binary search tree, so middle element of array ora sub array will always be root for that array or subarray.
Problem
Given a Binary search Tree and a target node value. Find the inorder successor of the given node value in the Binary Search tree given. Inorder successor of any node ‘x’ is basically the node which gets traversed immediately after ‘x’ in the Inorder traversal of a tree.
Solution : Leftmost and rightmost nodes of binary search tree are minimum and maximum nodes respectively
There are three cases which we may need to consider while deleting a node from binary search tree.
no child
one child
two children.
Binary search tree is a special type of Binary tree which have following properties.
A binary search tree is a special type of binary tree which have the following properties.