19: Growable Stack

Submit this homework using Gradescope. You can type up your answers, or write legibly and scan them. Do not attempt to submit a paper copy in class, as it will not be accepted.


In lecture we built a bounded array-based stack. But you can imagine a stack whose backing array grows as needed; we saw this much earlier in the semester. Suppose we were going to modify the BoundedArrayStack to be an UnboundedArrayStack that doubles the size of the backing array instead of throwing a StackOverflowException.

(3 points) Update the method(s) of BoundedArrayStack required to make it into an UnboundedArrayStack; show the full signature and body of any method(s) you modify or add. Be sure your new method(s) still implement the interface!