University of Nevada Las Vegas
Howard R. Hughes College of
Engineering
School of Computer Science
My Home Page
UNLV CS Spring 2007 Assignment 5

CS 302 Assignment 5
Due date: Tuesday, February 20, 2007, midnight.
All programming assignments must be
submitted electronically.
Submit them to the graduate assistant,
James Oravec,
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.)
Write a linked list implementation of a list, and then sort records from a
file.
-
The input of your program will be a file consisting of lines, which each
line consists of some text followed by an integer, which we call the
key. You may assume that there is at least one space between
the text and the number. The output of your program will be a file consisting
of same lines, sorted by key.
For example, if the input file is this:
Joe 3
Mary Lou 7
Aaron 6
Then your output file should be this:
Joe 3
Aaron 6
Mary Lou 7
-
Read the numbers from the standard input file.
As each number is read, a new node is created and appended to the linked
list.
-
You may assume that no input line has more than 80 characters.
-
Use insertion sort. After t insertions, the first t items in the list will
be sorted. Then, examine the next item, and
insert it into the correct place in the list.
-
You must use a singly linked list, not doubly linked.
-
Here is a larger file to practice on.
