Question: 13. Using the binary_tree_node from Section 10.3, write a function to meet the following specification. You do not need to check the precondition template bool

 13. Using the binary_tree_node from Section 10.3, write a function to

13. Using the binary_tree_node from Section 10.3, write a function to meet the following specification. You do not need to check the precondition template bool has 42 (binary_tree_nodecIte root_ptr) IPrecondition: root ptr ia the root pointer of a binary tree (but NOT NECESSARILY a search tree) / Postcondition The return value indicates whethe 42 appears somewhere // in the tree. NOTE: If the tree is empty, the function returns falae 14. Using the binary_tree _node from Section 10.3, write a function to meet the following specification. You do not need to check the precondition. template cclass Item bool al1 _42(binary_tree node int sum all(binary tree node size_t count42 (binary_tree_nodecItem root_ptr) / Precondition: root_ptr is the root pointer of a binary SEARCH tree // Post.condition: The return value indicates how many times 42 Ppears / in the tree 19. Using the binary_tree_node from Section 10.3, write a function to meet the following specification. You do not need to check the precondition. Make the function as efficient as possible do not visit nodes unnecessarily): template cclass Item int max( binary-tree-node* root-ptr) / Precondition: root ptr is the root pointer of a nonempty binary SBARCH / tree / Postcondition: The return value is the largest value in the tree 13. Using the binary_tree_node from Section 10.3, write a function to meet the following specification. You do not need to check the precondition template bool has 42 (binary_tree_nodecIte root_ptr) IPrecondition: root ptr ia the root pointer of a binary tree (but NOT NECESSARILY a search tree) / Postcondition The return value indicates whethe 42 appears somewhere // in the tree. NOTE: If the tree is empty, the function returns falae 14. Using the binary_tree _node from Section 10.3, write a function to meet the following specification. You do not need to check the precondition. template cclass Item bool al1 _42(binary_tree node int sum all(binary tree node size_t count42 (binary_tree_nodecItem root_ptr) / Precondition: root_ptr is the root pointer of a binary SEARCH tree // Post.condition: The return value indicates how many times 42 Ppears / in the tree 19. Using the binary_tree_node from Section 10.3, write a function to meet the following specification. You do not need to check the precondition. Make the function as efficient as possible do not visit nodes unnecessarily): template cclass Item int max( binary-tree-node* root-ptr) / Precondition: root ptr is the root pointer of a nonempty binary SBARCH / tree / Postcondition: The return value is the largest value in the tree

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!