I\'m trying to write the following using C++ regarding stacks but I\'m stuck: __
ID: 3648459 • Letter: I
Question
I'm trying to write the following using C++ regarding stacks but I'm stuck: __________________________________________________________________
Write a member function of class StackType that updates the stack when a page is referenced.
Assume a stack that can hold 5 values, and the next page referenced is 7,
then the function searches the stack for the page reference 7;
if it finds it, it removes it from the stack and places it at the top;
if there is not a 7 in the list, the last page reference in the stack is removed and the 7 is placed at the top of the stack.
for example:
stack:
9
5
6
7
1
after referencing 7:
7
9
5
6
1
use a non-recursive solution (can use a helper stack)
Use the following header:
template <class Type>
void stackType<Type>::update(Type t); __________________________________________________________________
Please read what I asked thoroughly before answering.