ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: Construct BST from preorder traversal Problem Statement: You are given an array representing a preorder traversal of a Binary Search Tree and construct the BST. Solution WKT the…
ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: LCA in a BST Problem Statement: You are given a BST root node and 2 node values n1 and n2, you need to find the Lowest Common Ancestor. Solution As we know…
ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: Convert a BST into greater sum tree Problem Statement: You are given a root node of BST. You need to convert into a greater sum tree. Example Input: 4 / \ 3 6 Output: 6 / \ 10 0…
ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: A program to check if a binary tree is BST or not Problem Statement: You are given a root node of a binary tree. You need to find out if a binary tree is a BST or not. Solution BST will have…
ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: Find the Inorder predecessor and successor for a given key in BST Problem Statement: You are given BST root and a key, find the inorder predecessor and successor for that key. If the key is not found, then…
ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: Find min and max value in a BST Problem Statement: You are given a BST root node, you need to find the max and min value. Solution To get the min value, traverse the node…
ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: Deletion of a node in a BST Problem Statement: You are given BST root node and a key value. You need to delete that node from BST. Solution There are few cases to be…
ProDeveloperTutorialonJanuary 19, 2025 Binary Search Trees: Find a value in a BST Problem Statement: Given a BST and a key element, you need to find if the key element is present in BST or not. Solution The solution is very…
ProDeveloperTutorialonJanuary 19, 2025 Binary Trees: Find Duplicate Subtrees Problem Statement: You are given a binary tree, you need to get all the duplicate subtree. You need to return the root of the sub trees.…
ProDeveloperTutorialonJanuary 19, 2025 Binary Trees: Kth Ancestor of a Tree Node Problem Statement: You are given a binary tree, a node and an integer “k”. You need to return the kth ancestor of that node.…