(solution) Introduction The purpose of this assignment is to become more

(solution) Introduction The purpose of this assignment is to become more

Introduction

The purpose of this assignment is to become more familiar with Stacks, Queues, and Lists by implementing

your own versions of them using Lists.

The Assignment

You will implement List, Stack, and Queue classes in Python using Lists as described in Chapter 2 of your

book. You must create classes for all of the above data structures so that a user may instantiate an instance

of the class (List, Stack, or Queue) and perform all operations listed below on them:

? List:

? add

? remove

? get

? set

? Stack:

? push

? pop

? top

? size

? isEmpty

? Queue:

? enqueue

? dequeue

? first

? size

? isEmpty

Be sure that you check carefully to ensure that you are following the specifications of these operations

properly. For example, some of the operations above have return values. Make sure you are returning the

appropriate values based on the pseudocode.

You may use built-in functions of the List class for any operation EXCEPT the following:

? List:

? Add

? Remove

? Stack:

? Push

? Pop

? Queue:

? Enqueue

? Dequeue

For the above functions you must use the pseudocode given in the book. Do not use built-in functions of

Python Lists that will do the work for you. For the rest of the operations, you may use any built-in functions you choose.

When using lists for any of these structures, you have a choice of growing the list or simply returning an

error when there are too many items in the list. You may simply return an error in this assignment.