Programming Project 1

Due: Monday, February 17, in class. Write a program to perform Shakersort on a file of integers. Shakersort operates similarly to Bubblesort, only it makes passes over the data in alternating directions. For example, if the contents of the file have been read into an array with the following configuration:
   4   7   9   5   3   7   8   4   3   2   1   9
Shakersort first makes a pass to the right (from cell zero to cell eleven), comparing adjacent cells' values and swapping them if the left cell's contents is greater that that of the right cell. Here are the results:
   4   7   5   3   7   8   4   3   2   1   9   9
Then Shakersort makes a second pass to the left (from cell ten to cell zero), comparing adjacent cells' values and swapping them under the same conditions. Here are the results:
   1   4   7   5   3   7   8   4   3   2   9   9
Make the third (and every odd numbered pass) from the left to the right and the fourth (and every even numbered pass) from the right to the left, until the array is sorted. Make each pass one shorter than the pass before to account for the integer that has found its final placement. Stop just as soon as the algorithm has ascertained that the list is sorted. This describes the basic project. For full credit, please add these refinements: