[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[On Teaching and Learning]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.5 API]
[Espresso]
[TAO of Java]
[CS152 2004F]
[CS152 2005S]
[CS152 2005F]
Back to Discussion of Exam 1. On to Heaps and Heap Sort.
Held: Wednesday, March 15, 2006
Summary: Today we investigate priority queues, linear structures in which the policy is highest-priority first, which usually translates into smallest first.
Related Pages:
Assignments
Notes:
Overview:
get returns the highest-priority object.
Comparable to each other, we use the compareTo method associated with those objects.
Comparator to use when we create the priority queue and use its compare method.
put take an additional parameter, the priority. I'd rather not change the signature of that method.
public class Prioritized<T>
{
T value;
int priority;
...
} // class Prioritized&tl;T>
unfairto low-priority tasks.
easysorting algorithm:
void put(T val)
T get()
boolean isEmpty()
put vs. order values on get
put: Emily
get: Emily
put: Aaron, Emily, Tony
get: Emily
live.
Back to Discussion of Exam 1. On to Heaps and Heap Sort.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[On Teaching and Learning]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.5 API]
[Espresso]
[TAO of Java]
[CS152 2004F]
[CS152 2005S]
[CS152 2005F]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 9 08:31:44 2006.
The source to the document was last modified on Thu Jan 12 14:58:06 2006.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2006S/Outlines/outline.31.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby