Write your answers to the following questions in a flat text file
hwkSorting.txt (not a Word document nor a Rich Text Format file).
- Trace the algorithms below sorting the following array:
- Insertion sort (at the end of each iteration of the outer loop)
- Bubble sort (after each swap)
- Heapsort (at the end of each iteration of each loop)
- Mergesort (at the end of each merge)
- Quicksort (after each swap, including swapping the same element in the same place and the swap for the pivot) (choose the pivot as described in the video)
- Radix sort (at the end of each iteration)
Please put each array on a separate line.
- For the two recursive sorting algorithms in the previous problem, trace the method calls and their parameters as was done in the videos (including indenting to indicate the call stack level). (If applicable, you can leave out a method call for choosing a pivot.)
- If you perform a simple external sort with 4 tapes (as described in the video) on 11 values with at most x=3 values fitting into main memory at once, how many times do you perform a read, write or rewind of x values to/from a tape? If two tapes are being read or written to simultaneously, count that as one wait. You can assume that all of the read/write heads are rewound to begin with and do not need to be rewound when finished. The values start on tape 1 and need to be back on tape 1 in sorted order. Here are some value to use if you want some concrete numbers: 94, 38, 71, 62, 14, 81, 12, 84, 70, 93, 75.
- For the following scenarios, choose the most appropriate sorting algorithm (from those discussed in class) and your justification of why it is the most appropriate:
- A large array that is almost already sorted
- Large objects (> 1 MB each) with unique keys for every person that is living or has lived.
- Your grades for assignments in this class.
Submission
Submit your txt file at
https://3110.cs.mtsu.edu/. For further instructions, please see the
Miscellaneous page.
Rubric:
Points Question
------------ --------------------------------------------------------------
_____ / 10.5 1
_____ / 3.0 2
_____ / 3.0 3
_____ / 1.5 4
_____ / 18.0 Total
Last Modified: