Question: Questions HandsOn > Max Or Min Tree You have a tree containing N nodes which is rooted at riode 1 . In this tree every
Questions
HandsOn Max Or Min Tree
You have a tree containing nodes which is rooted at riode In this tree every node i has a vafue of
You would be asked to traverse the tree starting froma node till you encounter a leaf as per the following rules:
Next node to be traversed should be a child of the current node.
The chosen child should have either maximum or minimum of the values of all children.
For everys subsequent traversal, you need to swap the choice of minimut or of
You could forego the swap restriction at most once.
Yourobjective is to maximize the sum of the values of the traversed nodes including starting node.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
