Home Stacks and queues

Allowable methods

You may only use the push, pop, peek, size, and isEmpty methods of stacks. You may only use the add, remove, peek, size, and isEmpty methods of queues.

Furthermore, you may not iterate over stacks and queues by using foreach loops or iterators.

Do not destroy client data structures

When a client gives you a data structure of some kind, you should always make sure that the data structure remains unmodified once your method is finished, unless the spec explicitly tells you otherwise.