Homework on sorting

Homework on sorting

This homework should be done in hard copy.

Each subroutine should be divided into as many subroutines as is possibly natural. If I can naturally divide up one of your algorithms, it will be considered incorrect!

Each subroutine should check that its inputs are basically correct.

Each subroutine should have a comment describing how to use it. What it returns. And what has to be passed in.

  1. Write a quick sort in perl.

  2. Write a selection sort in perl.

  3. Make a plot of the CPU time vs size of input for each algorithm.

  4. Surf the web and find a merge sort in perl. Print it out. See if you can understand what it is doing. How many subroutines could you break it into?