1. A function int MaxStack (stackclass S); will return the largest value in an ADT stack of integers. Write the code for this function. Note: your function will be a client of the ADT, not a part of it, so you must use the ADT operations to access the stack. You can assume the copy constructor for the stack has been implemented.
2. Suppose you are asked to create a new method for the stack class, PopN, defined as follows:
PopN(S, n)
{ Removes from stack S the n number of items that were
most recently added. It is an error if there are
fewer than n items on S. }
To implement this operation, you could either modify the stack directly or use the existing Pop operation. What would be the advantages and disadvantages of each method?