Assignment 7 - Queues and Applications

For this assignment we will use Netscape Chat to work together on the ADT Queue and an application Palindrom.

Please join the #cs-1112 chat room on Friday, March 29, at 2:30pm for details. Connect to the chat server sciris.shu.edu on port 7007 at the given time and wait for further instructions. Anyone is welcome to join.

Chat Group 1: Click here for details
Chat Group 2: Click here for details
Chat Group 3: Click here for details
Final Assignment: click here for details
Unit Queues;
{ A queue is a collection of elements having a head and a tail. Elements }
{ can only be inserted at the tail of the queue, and they can only be    }
{ retrieved from the head of the queue. In other words, the element that }
{ has entered the queue first can leave it first (FIFO - First In, First }
{ Out).                                                                  }

Type
    StdElement = Char;

    NodePointer = ^Node;
    Node = Record
                 Data: StdElement;
                 Next: NodePointer;
           end;

    Queue = Record
                  Head : NodePointer;
                  Tail : NodePointer;
                  nnodes: longint;
            end;

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:  none }
{ POST: Creates a valid, empty queue }

(bgw)