Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

Program 5 Page 1 CS 2420 Fall 2010

Summary: Program 5 Page 1
CS 2420 Fall 2010
Program 5 20 points
Priority Queues (Heaps)
Objective: Implement a priority queue.
Priority Queue
A max priority queue is a data structure that allows at least two operations: insert which does the
obvious thing and deleteMax, that finds, returns, and removes the maximum element in the
priority queue. The max priority queue will be implemented as a binary heap (a table which
logically represents an almost complete binary tree).
The data you will use to test this priority queue is the concordance you produced in program 4.
If you didn't complete that program, you can just input a copy of the output file from program 4
(prog5.txt). Make sure your array is large enough to hold all the words.
You are to insert all the data (word and occurrenceCt) into the priority queue and then delete
them one at a time (to produce a sorted list). (This is actually an unimpressive way of using a
priority queue, as the priority queue can handle interleaved insertions and deletions.)
The output will be the entire concordance with the most commonly used word(s) and number of
occurrences listed first, and the least commonly used word(s) and number of occurrences listed
last. Be sure to send the output to a file, prog5out.txt.
When you have completed the assignment, zip your entire project and submit the zip file to


Source: Allan, Vicki H. - Department of Computer Science, Utah State University


Collections: Computer Technologies and Information Sciences