Question: Exercise (20 points) Let R be a binary tree of integers without repetition, (each node contains a value whole), it is assumed that the tree
Exercise (20 points)
Let R be a binary tree of integers without repetition, (each node contains a value
whole), it is assumed that the tree is already created.
Write an algorithm that allows to:
1) Calculate and display the product of the values stored in the nodes of the tree R, (if the tree is empty the algorithm must display the zero). (7 dots)
2) Calculate and display the depth of the node which contains a given value (V), (if the tree is empty, or (V) does not exist, the algorithm must display (-1)). (6.5 marks)
3) Create and display a linked linear list (L) containing a path connecting the node
of the root with the one that contains the value (V). (6.5 marks)
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
