Latest Update: 05/05/2000
Week 12 Notes for CS 2500 -- Spring 2000
(this is draft material)
* Take roll
==================================================
WEDNESDAY
==================================================
############################################################
* I sent e-mail reports/critiques out on program #3. I have
not assigned grades yet. I will do that ASAP.
############################################################
* Schedule Highlights
+ Last quiz on the last day -- May 22.
* Prog #4 assignment is in the web space. Be sure to use the
subject line requested!
* Pass back Quiz #2 to those who did not get it yet. Check my arithmetic
* Any questions about program #4?
* Quick look at:
+ The pointer-based implementation of a stack.
+ implementing a stack with a list.
+ comparison of stack implementations.
^ most any array-based implementation can be very
efficient. There's no need to move elements, but if
you implement a stack as a list, it might happen
"inadvertantly"
^ The pointer-based implementation is very efficient
execpt for the destructor. It has the added
advantage of dynamic memory allocation.
^ The pointer-based or array-based list implemenations
can be as good as coding "from scratch," but
implementation of the list can affect efficiency
greatly. The biggest advantage is savings in
programmer time.
* We begin to discuss queues.
* What is a queue? What are some of the important uses of
queues?
+ customer/service queues
+ process ready queue
+ breadth-first search
+ radix sort
* The operations of our implementations:
queueClass(); // default constructor
bool QueueIsEmpty() const;
void QueueInsert(queueItemType NewItem, bool& Success);
void QueueDelete(bool& Success);
void QueueDelete(queueItemType& QueueFront, bool& Success);
void GetQueueFront(queueItemType& QueueFront, bool& Success) const;
* The pointer-based implementation of a queue.
+ When we implement a FIFO queue as a "linear"
structure, we find it convenient and efficient if we
insert elements at one end and remove them from the
other.
+ In a linked list implementation, for efficiency we
want to have immediate access to both ends of the
list. One easy way to do this is to keep an external
pointer (a private variable in the class) to the rear
element, and require that the rear element always
point to the front element.
+ Our implementation is as described above -- a circular
linked list implementation.
+ Look at the annotated code QueueP.h and especially
QueueP.cpp. Draw some pictures.
* The array-based implementation of a queue.
==================================================
FRIDAY
==================================================
* implementing a queue with a list.
* comparison of queue implementations.
* Program #5 has been assigned. Let's take a look.
* Let's start discussin Binary Search Trees.