Category Archives: Binary Search Tree

Maximum element between two nodes of BST

Given an array of N elements and two integers A, B which belongs to the given array. Create a Binary Search Tree by inserting element from arr[0] to arr[n-1]. The task is to find the maximum element in the path from A to B. Examples: Input : arr[] = { 18, 36, 9, 6, 12,… Read More »

Print Common Nodes in Two Binary Search Trees

Given two Binary Search Trees, find common nodes in them. In other words, find intersection of two BSTs. Example: We strongly recommend you to minimize your browser and try this yourself first. Method 1 (Simple Solution) A simple way is to one by once search every node of first tree in second tree. Time complexity… Read More »