Question: 3 3. (10 pts.) Write a method that will take two sorted stacks a and b (min on top) and create one stack that is
3 3. (10 pts.) Write a method that will take two sorted stacks a and b (min on top) and create one stack that is sorted (min on top). You are allowed to use only the stack operations such as pop, push, size and top (top) returns the top element on the stack). No other data structures such as arrays are not allowed. You are allowed to use only stacks. Note that elements on the stack can be compared using compare To. public Stack mergeSorted Stacks(Stack a. Stack b) {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
