Question: Complete the following function that returns the largest element of the binary tree rooted at root. template T max (Node * root) { if

Complete the following function that returns the largest element of the binary tree rooted at root. template T max (Node * root) { if (root == nullptr) return T(); T max1 T max2 root->x; root->x; if (root->left != nullptr) max1 = max(root->left); if (root->right != nullptr) max2 = max(root->right); if (root->x >= max1 && root->x >= max2) return if (max1 >= root->x && max1 >= max2) return _ ; return }
Step by Step Solution
There are 3 Steps involved in it
Sure Heres the complete function that returns the largest element of the binary tree rooted at root ... View full answer
Get step-by-step solutions from verified subject matter experts
