Group 3: PutInQueue, PutInStack

Recall:
A Queue is a 'FIFO' list (First-In-First-Out), and a Stack is a 'LIFO' list (Last-In-First-Out). Also, a Palindrom is a word or sentence(s) that reads forwards the same as backwards (as in 'otto').
Your Task:
We want to write an application that tests a string for being a palindrom. To do this, we will need two procedures: PutInStack and PutInQueue, and we will make use of the Stacks and the Queues unit. You have to write these two procedures:
The PutInStack procedures has a stack and a string as parameters. It initializes the stack to be empty and then pushes each character from the expression into the stack.
The PutInQueue procedure has a queue and a string as parameters. It initializes the queue to be empty and then enqueues each character from the expression into the queue.
Details:
You have 15 minutes to come up with the two routines. Select one person as speaker of the group. When you have come up with your answer, the speaker should post the solutions on the bulletin board as two seperate postings. Each of you might want to bring up Notepad for taking notes, if you like. For details on the operations on Queues and Stacks, see below. Note that you do know know if Queues and Stacks are implemented using pointers or arrays.

Unit Queues;
   { A queue is a FIFO - First In, First Out sequential }
   { structure with the following operations defined:   }
procedure Enqueue(var Q: Queue; el: StdElement);
   { PRE:  The queue is not full }
   { POST: Q includes el as its most recently arrived element }
procedure Serve(var Q: Queue; var el: StdElement);
   { PRE:  The queue is not empty }
   { POST: The least recently arrived (i.e. the 'oldest') element is removed }
   {       from the queue, and returned in el }
function IsFull(Q: Queue): boolean;
   { PRE:  none }
   { POST: If the queue is full, returns true, else returns false }
function IsEmpty(Q: Queue): boolean;
   { PRE:  none }
   { POST: If the queue is emtpy, returns true, else returns false }
procedure MakeEmptyQueue(var Q: Queue);
   { PRE:  noe }
   { POST: Creates a valid, empty queue }

Unit Stacks;
   { A stack is a LIFO - Last In, First Out sequential }
   { structure with the following operations defined:   }
procedure MakeEmptyStack(var S: Stack);
   { PRE:  none }
   { POST: S is a valid, empty Stack }
procedure Push(var S: Stack; el: StdElement);
   { PRE:  The stack is not full }
   { POST: S includes el as its most recently arrived element }
procedure Pop(var S: Stack; var el: StdElement);
   { PRE:  The stack is not empty }
   { POST: The most recently arrived element is removed from the }
   {       stack and returned in el }
function IsFull(S: Stack): boolean;
   { PRE:  none }
   { POST: If the stack is full, returns true, else false }
function IsEmpty(S: Stack): boolean;
   { PRE:  none }
   { POST: If the stack is empty, returns true, else false }