Chris Pollett >
Old Classes >
CS146

   ( Print View )

Grades: |Sec6|Sec8|

Course Info: Homework Assignments: Practice Exams:
                           












HW #4 Page

HW#4 --- last modified January 16 2019 00:35:12..

A solution set is posted here.

Due date: Nov. 5.
========= 

Files to be submitted:  cs146sec6hw4file1.java (sec 8 if that's your section)
======================  

Purpose: To learn about d-Heaps, Skew Heaps, Binomial Heaps, and Insertion 
======== Sort

Specification:
==============
Your program will be tested by running it from the command line with a line
like:

java cs146sec6hw4file1 x filename

where x is a String among 3heap, skew, binomial, insertion and filename is 
the name of a file consisting of integers on distinct lines to be sorted in 
ascending order. The x indicates the sorting algorithm. If x is 3heap then
the file is read-in a build3Heap operation is performed and deleteMin's
are used to output the sorted values. Similarly, if x is skew or binomial
then a Skew Heap or a Binomial Heap is used to do the sorting. Finally,
if x is insertion then Insertion Sort is used to do the sorting. You may use
the code from the book for Binomial, and the code for Insertion Sort. All
other code must be your own individual work. 

As an example, the file might contain:

24787
234
4565
432
5645
141923784
321

Your program should output to the standard output the integers in ascending
order:

234
321
432
4565 
5645
24787
141923784

Point Breakdown
===============
Department Coding Guidelines followed.1pt
Command line arguments handled 
   correctly..........................1pt
File read in correctly................1pt
build3Heap works correctly............1pt
3-Heap Sort works.....................1pt
Skew Heap Sort works..................1pt
Binomial Heap Sort works..............1pt 
Insertion Sort works..................1pt


Total.................................8pts                          

A solution set is posted here.