Data Structures, Algorithms, & Applications in C++
Chapter 8, Exercise 7
- (a)
-
The extensions are
- input( ):
-
Input a stack from bottom to top;
- toString( ):
-
Return the stack elements, as a string, from bottom to top;
- split(a, b):
-
Split a stack into the stacks a and b.
Stack a contains the bottom-half elements, and
stack b contains the remaining elements.
- combine(a, b):
-
Combine the stacks a and b into
a single stack.
The elements in the combined stack are the result of placing
stack b on top of
stack a.