Question: marks) Write a function int maxVal(treeNode *ptr), which is provided the root of a binary tree as a parameter, and it finds and returns the

marks) Write a function int maxVal(treeNode *ptr), which is provided the root of a binary tree as a parameter, and it finds and returns the maximum value in the tree. No other function should be made, nor any variable outside of this function is allowed. Note that the tree is not a BST, rather its just a binary tree, and any node can have any integer value.

c++ program

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!