Question: Write in pseudocode an algorithm maxValue(r) that receives as input the root r of a tree (not necessarily binary) in which every node stores an

 Write in pseudocode an algorithm maxValue(r) that receives as input the

Write in pseudocode an algorithm maxValue(r) that receives as input the root r of a tree (not necessarily binary) in which every node stores an integer value and it outputs the largest value stored in the nodes of the tree. For example, for the following tree the algorithm must output the value 9. 4) (9 4 7 For a node v use v.value to denote the value stored in v; v.isLeaf has value true if node v is a leaf and it has value false otherwise. To access the children of a node v use the following pseudocode: for each child c of v do 5.(ii) (3.5 marks) Compute the worst case time complexity of your algorithm as a function of the total

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!