Stack

Hello Can anyone help me with the following question

1. Assume tht 'Stack' is the class described in this section with 'StackType' set to int and STACK_CAPACITY or myCapacity set to 5. Give the value of 'myTop' and the contents of the array referred to by 'myArray' in the Stack s afer the code segment is executed, or indicate why an error occurs.
Stack s;
s.push(10);
s.push(22);
s.push(37);
s.pop();
s.pop();


2. Suppose that some application requires using two stacks whose elements are of the same type. A natural storage structure of such a two-stack data type would consist of two arrays and two top pointers. Explain why this may not be a spacewise efficient implementation.

3. USing the basic queue and stack operationns, write an algorithm to reverse the elemens in a queue.
That would defeat the purpose of homework, now, wouldn't it?
We may be more helpful if you ask very specific questions and show an effort do something yourself.
Topic archived. No new replies allowed.