Question: Rewrite your sequence class but this time instead of the items being stored in a linked list, they will be stored using two STL stacks
Rewrite your sequence class but this time instead of the items being stored in a linked list, they will be stored using two STL stacks as private member variables. You must use the following implementation:
1. There will be exactly two data members, both STL stacks, named stack1 and stack2.
2. The bottom of stack1 is the beginning of the sequence.
3. The elements of the sequence continue up to the top of stack1.
4. The next element of the sequence is then the top of stack2.
5. The elements of the sequence then continue down to the bottom of stack2 (which is the end of the sequence).
6. If there is a current element, then that element is at the top of stack1. As a result, if there is no current item, stack1 will be empty.
The sequence tester from previous assignments should definitely still work with your new sequence class; however, in my experience it does not do a good job of exhaustively testing it. Note: You do not need to write your own assignment operator, copy constructor, or destructor, because you won't be doing any dynamic memory allocation in your class.
https://pastebin.com/qFkP33cs (sequence.h)
https://pastebin.com/PmmDz8iH (sequence. cpp); client program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
