
CS 302 Assignment 2
Due date: Thursday, Februay 2, 2006, 8:30 AM in class.
All programming assignments must be
submitted electronically.
Submit them to the graduate assistant,
Premalatha Reguraman,
on or before the due date.
All written assignments must be handwritten (not typed or printed from a
computer file) in your own handwriting, on 8.5 by 11 inch paper, or on A4
paper. Write your name on each sheet, and do not fold the pages or crimp the
corners. (You may use a paper clip or a staple.)
Turn the pages in to me or to the graduate assistant on the due date.
Write a program which
-
Reads real numbers from a file into an array of size no more than 1000.
-
Sorts the array using selection sort.
-
Sorts the same array using bubblesort.
-
Sorts the same array using Shell sort.
Count the number of comparisons in each case and report that number.
Use the following two files to test your program:
a small file
a large file