Computer Science 230 Homework 3




Assignment:

We haven't done anything with a circular
structure. Amazingly, if we implement the linked queue with a circle, we can do
away with the front reference and have only a rear reference. (We cannot keep front and eliminate rear,
or at least it is inefficient to do so.)

 

This implementation has no dummy nodes, so
don't forget that you may need to change what rear
itself is pointing to. Also, the empty queue (starting from empty or becoming
empty) may be a special case.

 

Part 1: Write the Java code or pseudocode for
enqueue() for the singly-linked circular queue
implementation with a rear, NO front,
and no dummy node.

Part 2: Write the Java code or pseudocode for
dequeue() for the singly-linked circular queue
implementation with a rear, NO front,
and no dummy node. Use the version of dequeue() that deletes the node from the
queue and returns the value that was in it.

 

Submission:

Put your name in
all files that you submit. Submit this file as <yourName.<ext, where <yourName is your last name and <ext is one of txt, rtf, doc, docx, or pdf. Submit on
WebCT by the date and time above.

 

 













 

 

 

 

 

 

 

 

 

 

 

 

 

 
Powered by