Given a Binary Search Tree. The task is to find the sum and product of maximum and minimum value of tree.
For the above tree, sum and product of maximum and minimum value of tree is 26 and 88 respectively.
- For the node with minimum value: Find the leftmost leaf node
- For the node with maximum value: Find the rightmost leaf node
Below is the implementation of the above approach:
Sum of Maximum value and Minimum value in BST is 7 Product of Maximum value and Minimum value in BST is 6
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Sum and Product of maximum and minimum element in Binary Tree
- Find maximum and minimum element in binary tree without using recursion or stack or queue
- Minimum swap required to convert binary tree to binary search tree
- Find the closest element in Binary Search Tree
- Find the node with minimum value in a Binary Search Tree
- Find the node with maximum value in a Binary Search Tree
- Sum and Product of minimum and maximum element of an Array
- Find the node with minimum value in a Binary Search Tree using recursion
- Find the node with maximum value in a Binary Search Tree using recursion
- Maximum height of the binary search tree created from the given array
- Find the closest element in Binary Search Tree | Space Efficient Method
- Find maximum level product in Binary Tree
- Find maximum count of duplicate nodes in a Binary Search Tree
- Find maximum (or minimum) in Binary Tree
- Print all paths of the Binary Tree with maximum element in each path greater than or equal to K
- Minimum and maximum node that lies in the path connecting two nodes in a Binary Tree
- Complexity of different operations in Binary tree, Binary Search Tree and AVL tree
- Binary Search Tree | Set 1 (Search and Insertion)
- Convert a Binary Search Tree into a Skewed tree in increasing or decreasing order
- Count the Number of Binary Search Trees present in a Binary Tree
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.