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
Get step-by-step solutions from verified subject matter experts
