Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started