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.…
ProDeveloperTutorialonJanuary 19, 2025 Binary Trees: Maximum Sum of nodes in Binary tree such that no two are adjacent Problem Statement: You are given an binary tree, you need to return the sum of the nodes such that no two nodes are adjecent. It means, if we…
ProDeveloperTutorialonJanuary 19, 2025 Binary Trees: Find largest subtree sum in a tree Problem Statement: Given a binary tree, you need to find the subtree with maximum sum in tree. Example Input : 1 / \ -2 3 / \ / \ 4 5 -6 2…
ProDeveloperTutorialonJanuary 19, 2025 Binary Trees: Check if a given graph is tree or not Problem Statement: You are given an undirected graph, you need to check if the graph is a tree or not. Example In the below image, first graph…