Sorting and Searching homework
Due date given in class
To be handed in via hard copy on the date specified
Data set to use for sorting each question
65, 34, 27, 84, 92, 54, 82, 15, 75, 49, 50, 21
- Sort via the selection sort. Show your work after each pass through the "outer loop". Include passes that due nothing.
- Sort via the insertion sort. Show your work after each pass through the "outer loop". Include passes that due nothing.
- Sort via the bubble sort. Show your work after each pass through the "outer loop". Include passes that due nothing.
- Sort via the merge sort. Show your work before each merge.
- Sort via the heap sort. Show your work after each adjustment of the "heap"
- Complete the following chart
- If you had to sort data that was so large it could not fit into memory, what sort would you consider modifying? Why? What is the work you are trying to minimize?
Sort name |
Best Case Description |
Base Case Work Compares |
Best Case Work Moves |
Worst Case Description |
Worst Case Work Compares |
Worst Case Work Moves |
Average Case Work Compares |
Average Case Work Moves |
Selection Sort |
|
|
|
|
|
|
|
|
Insertion Sort |
|
|
|
|
|
|
|
|
Bubble Sort |
|
|
|
|
|
|
|
|
Merge Sort |
|
|
|
|
|
|
|
|
Heap Sort |
|
|
|
|
|
|
|
|