ProDeveloperTutorialonAugust 30, 2026 Binary Tree: You are given a binary tree, you need to print the extreme nodes in alternate order. Problem Statement: You are given a binary tree, you need to print the extreme nodes in alternate order. Example: Input: Output: 7 6 Solution…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Given a binary tree, connect nodes at the same level Problem Statement: Given a binary tree, you need to connect the nodes. Each nodes will have a next pointer, set these pointers to the next…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Level order traversal of a Binary Tree Problem Statement: Given a binary tree, perform level order traversal. Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9 11 14 */ Output:…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Convert BST to Max Heap Problem Statement: Convert a BST into Max Heap. Max Heap property: All the values in the left sub tree of a node should be less than the value…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Given a BST and a target, find if a pair exists Problem Statement: You are given a BST and a target, you need to find if such pair exist in the tree. Example: Input: target: 26 /* * 10 * / \…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Convert BST to Min Heap Problem Statement: Convert a BST into Min Heap. Min Heap property: All the values in the left sub tree of a node should be less than the value…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Given a binary tree, perform reverse level order traversal Problem Statement: Given a binary tree, perform reverse level order traversal from bottom up and from left to right Example: Input: /* * 10 *…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Maximum path sum in a binary tree Problem Statement: Given a binary tree, find the maximum path. Path does not need to pass through the root. A path can include each node at…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Given a binary tree, check if the tree is perfect or not. Problem Statement: You are given a binary tree, you need to check if it is a perfect binary tree or not. A binary tree is considered as…
ProDeveloperTutorialonAugust 30, 2026 Binary Tree: Given a tree, delete leaf nodes with value k Problem Statement: You are given a tree and a value k. You need to delete all the leaf nodes with the given value Example: Input: /* * 10 * /…