Case 1: Write a function that compares two stacks for equality. The function takes two stacks as parameters and returns true if they are identical. The stacks should remain unchanged after the function returns to the calling program.
Case 2: In this second case, the stack parameters will not be const reference parameters because they are temporarily changed before being restored. As an alternative, the parameters could be value parameters (so that changing them does not affect the actual arguments).
Question: Which of the three approaches (friend function, reference parameters, or value parameters) will be most efficient?
Can anyone provide the answer for given question?