InClassExercise24 - Interaction class to comment out the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS112: In-class Exercise 24 Sorting 0. Review of sorting methods for n items. a. Bubble sort: n n 2 1 2 2 1 - comparisons. b. Selection sort: n n 2 1 2 2 1 - comparisons. c. Insertion sort: n n 4 1 2 4 1 + comparisons on average. d. Merge sort: n n 2 log comparisons. 1. Copy the InClass24 folder from the usual locations. 2. Exercise A – no coding required! Run the program on input filenames o unsorted1000.txt o unsorted2000.txt o and so on until it takes too long to do bubble sort. After that, run only Merge Sort on the rest of the data files by editing the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Interaction class to comment out the Bubble, Selection, Insertion sort methods. Recompile and run on the longer files. • Make a table of the sorting times (use Excel if you like, with sort methods as column headings). • Can you see a pattern? Think about what we discussed in class. Just say something intelligent. For example, when the size of the file doubles, does the running time double as well? • That’s all....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online