Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need to be solved ASAP. Thank you 1. (2 points) Draw all possible binary trees containing 3 nodes. 2. (8 points) Suppose Binary_Search_Tree variable t
Need to be solved ASAP.
Thank you
1. (2 points) Draw all possible binary trees containing 3 nodes. 2. (8 points) Suppose Binary_Search_Tree variable t has the following value 15 0 5 (a) Draw the tree that results after executing (all of) the following operations: t.insert (25) t.insert (12): t.insert (30); t.erase (38); t erase (5) t.erase (35) (b) Give the order the nodes of the resulting tree from part (a) are visited when the tree is traversed by in- order, pre-order, and post-order scans. 3. (4 points) Write a Binary_Search_Tree member function sum that returns the sum of the items in its tree. Assume that a default constructor and operator+ are defined for the item type T. If the tree is empty return the default constructed T item. (To call a default constructor without declaring a variable, just give the name of the default constructor with no arguments. E.g. return TO) You should write a recursive helper function to do this. You also should assume that the code is in-lined into the template definition like the other member functions in bst.hStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started