Problem 12 (10pts)
Stack memory is implemented as a stack data structure.
A) Provide the sequence of push and pop operations on stack memory when the display
method (provided below) is called with curr = root on the BST shown below. When
specifying a push, provide the Node parameter by indicating the value it stores.
private void display(Node curr){
if(curr != null){
display(curr.left);
display(curr.right);
System.out.print("+ curr.data);
}
}
B) What is printed out by the display method above when run on the BST shown above
(curr=root)? The node class is implemented in the typical way (has Node left, right, and
int data).
Problem 13 (10 pts):
What is the worst case time complexity for bucket sort? Explain why and provide an
example. When would you use bucket sort over any of the compare based sorting
algorithms?