Question: Let a binary search tree be defined by the following class: public class Tree { private Node _root; 1/ constructors and other methods omitted for

Let a binary search tree be defined by the following class: public class Tree { private Node _root; 1/ constructors and other methods omitted for clarity private class Node { public int _data; public Node left; public Node right; 11 constructors omitted for clarity } } (a) Given a binary search tree (as defined above), write a method (sufficient to present a pseudocode) to output the elements in sorted order. (b) Let n be the number of nodes in a binary tree. What is the runtime of your method from Question 1(a) as a function of n? (C) Draw the binary search tree after the execution of each operation in the sequence insert(10), insert(20), insert(15), insert(2), insert(25), insert(22), insert(50), remove(2), remove (20), remove(10), insert(33), remove(50), insert(20). Assume that the tree is empty before the execution of the sequence
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
