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
  1. The program should prompt the user for the number of numbers that will be entered
  2. Store the numbers in an array of pointers (int **).
  3. Prompt the user for the numbers
  4. Sort the numbers by modifying the pointers. (Use a different sorting algorithm than the one in Lecture 3)
  5. 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

  1. Bring a print out to class
  2. Send me the source file