Homework Laboratory Assignment 7
For the next assignment of the semester, we shall continue the use of modular programming. 1. First you must write a complete program which will use the random number generator to generate N random integers each between one and MAX. You must have modules GenerateAndFillArray() DisplayArrayOnScreen() WriteArrayToFile() 2. You must then write two sorting programs, the insertion sort, and the bubble sort. In these programs, you must have modules FillArrayFromFile() DisplayArrayOnScreen() SortArray() DisplayArrayOnScreen() The due date for the first program is March 6, 1998. The due date for the second program is March 20, 1998. In order to test your programs and see if they work correctly, test your programs on several data files of varying sizes. Sort with N = 100, 500 and 1000 and count the number of comparisons it takes to sort the various files. Also, test your programs on data files which are in sorted order and in reverse sorted order, to see how your algorithms behave in these cases. Gather some data concerning sorting and tell which of the algorithms appears to be most efficient. What can you do, if anything, to improve the efficiency of your sorting algorithms? Make sure your handin includes 1. A title page with the correct laboratory exercise number 2. A page of formal documentation 3. A page of informal documentation 4. The source code 5. Several sample executions of the program