Sorting Homework

Topics: File I/O, Arrays, Sorting Algorithms

  Download the following .cpp file, along with the whale.txt text file:

                sortlingHwk.cpp

                whale.txt

For part 1, implement “locateSmallest”, “printItems”, “reverseOrder”, “shuffle”, and finally “sort”. 

For part 2, read in each word from whale.txt (it’s Moby Dick) and output the words from this story to a file “sortedWhale.txt” in sorted order.  The file contains exactly 211348 words.  Give your program a good 3 minutes or so to finish this grueling task.  Include an analysis of the big-Oh run time of your sorting algorithm (the number of steps in terms of the number of items n being sorted).  This analysis can be provided in your program comments.  Also, include the total time (in minutes and seconds) your algorithm took to sort the whale.txt file.

Since the goal of this homework is to design a sorting algorithm, you may not utilize any pre-made sorting algorithms from an external library.