Overview
This week we will finish our study of queues and priority queues.
Friday, March 21st
Classwork / Homework
We'll get back our quizzes on priority queues and go over them.
You will have the rest of class time and homework time to work in your quueue groups on the following project.
RGThing Priority Queues
Given the following:
enum Color {RED, GREEN}; struct RGThing { Color color; string label; }; struct RGTpair { RGThing thing1; RGThing thing2; };
Create a RGTPQ
class implements a priority queue of
RGThings
with the following member functions:
bool empty();
void insert(RGThing);
RGTpair remove();
RGThing
s can be inserted (using the insert(RGThing)
member function) as they arrive, and they are removed from the
RGTPQ
using a FIFO discipline, except for the following additional
requirement: the remove()
member function returns an
RGTpair
with one RED
and one GREEN
RGThing
.
This means that RGTPQ
has to implement a hybrid discipline,
since if it is filled with only RED
RGThing
s, no
pair can be removed. The first GREEN
RGThing
that
enters the queue will thus have to be given a priority discipline that moves
it to the front of the queue.
Come to class Tuesday ready to be present your solutions.
Monday, March 17th and Wednesday, March 19th
Classwork / Homework
As we discussed last week, we will let Python
(>>> randint(1, 4)
) decide among the groups:
- Turner, Caleb, Cody and Parker
- Marin, Luis, Anfal and Ved
- Anar, Johan, Issac and Jamethiel
- Trostin, Akshay and Adonis
The selected group will share their deliverables from last week with the rest of us. The other groups will be individually evaluated based on their git repos, using the usual standards for evaluation.
After the presentation, you will have the rest of class and homework time Monday and Wednesday to read the now more or less completed Chapter 19: Queues and priority queues, and to complete all the activities in each of the three exercise sets linked at the end of the chapter.
Come to class Wednesday prepared for a short quiz on Monday's presentation.
Come to class Friday ready to be randomly chosen to present your work from the exercises.