CS 241 Data Structures- Lab 5, Due 3/16

Sort Timing

Your task for this lab is to implement two O(n^2) sorts:, insertion sort, and selection sort; then time them (and bubble sort) on various sized lists, namely 1000, 2000, 4000, 8000, etc (by passing them to a SortTimer) to verify they are actually O(n^2).

Approach

I have provided working code that tests three instances of BetterRandom and three of BubbleSort. Copy my code and add selection and insertion sort.
Those sorts have been presented in class; modify them to work in the context of that code, to produce output that looks something like:
            T I M I N G   T H R E E   S O R T S !
        	bubble	insert	 select		
	n=1000	 t=19	 t=8	 t=8	
	n=2000	 t=25	 t=1	 t=4	
	n=4000	 t=33	 t=6	 t=16	
	n=8000	 t=149	 t=28	 t=48	
	n=16000	 t=586	 t=89	 t=197	
	n=32000	 t=2513	 t=338	 t=780	
	n=64000	 t=9288	 t=1373	 t=3101	

Details

  1. Use this (or the .zip of it on examplesFromClass -- I made that zip file on the classroom PC, so if it does not work for you, let me know!) as a base (feel free to copy paste any code you like).
  2. Test your sorts with n=something_small, to make sure they actually work! Come up with some way that it is quick to demonstrate that they work when you demo (i.e. a button, or menu item, or test module of whatever stripe you like).

Demo your code during lab for credit.