eecs 233 hw2alternate

eecs 233 hw2alternate - EECS 233 / Summer 2006 Homework...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
EECS 233 / Summer 2006 Homework 2-alternate Design Document Benjamin Horstman The assignment was to implement a heap efficiently using arrays. The heap class is used in three ways, as a priority queue, to find the k highest priority items, and heapsort over all items (same as k=n highest items). The assignment was done in Java using Eclipse 3.1.2 and Java 5.0 compliance. The program reads pairs of integers from the file C:\data.dat. The first is the priority and the second is the data value. If there are non-integers, integers which are too large, or an odd number of integers, failure will occur. The intheap class can be used as a FIFO priority queue data structure. Larger values are treated as higher priority, though this is very flexible. An actual implementation of this data structure would probably use generics; this assignment only handles integer data. Ties have been resolved by keeping track of the age of every entry, and placing older entries higher in the heap. (older entries have a smaller ctr value in
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/09/2008 for the course EECS 233 taught by Professor Rabinovich during the Spring '08 term at Case Western.

Ask a homework question - tutors are online