CS 302 - Data Structures & Algorithms II - Spring 2008
Homework 3
Loyola College >
Department of Computer Science >
CS 302 >
Homework >
Homework 3
Due
Friday, January 25 at the beginning of class
Assignment
Write a program that sorts numbers
- The program should prompt the user for the number of numbers that will be entered
- Store the numbers in an array of pointers (int **).
- Prompt the user for the numbers
- Sort the numbers by modifying the pointers. (Use a different sorting algorithm than the one in Lecture 3)
- Output the sorted list
Use /cs302/code/number_sort.c as a starting point for completing this homework.
The picture below illustrates how the sort works. When the program runs, space
is created for each number and the number is stored. This is represented
by the black pointers. During the sort, you
should rearrange the pointers rather than changing the values of the pointees,
as shown by the pink pointers. (Obvoiusly this is the end result of the sort, there may be many different intermediate states.)
Turn in
- Bring a print out to class
- Send me the source file