For your each
sorting algorithm:
- Insertion sort
- Heapsort
- Mergesort
- Quicksort
- Bucket sort
- Radix sort
do the following:
- Describe how the algorithm works
-
Trace the following algorithms sorting the following array:
2152 |
3180 |
725 |
1781 |
1248 |
4590 |
2990 |
633 |
by writing the contents of the array according to the specified criterion:
- Insertion sort (at the end of each iteration of the outer loop)
- 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)
- Bucket sort (show the buckets)
- Radix sort (at the end of each iteration)
- Write down the following properties for the stated sorting algorithms:
|
Average-case Running Time |
Worst-case Running Time |
Stable? |
Extra Space |
Distinguishing Features |
Insertion Sort |
|
|
|
|
|
Heapsort |
|
|
|
|
|
Mergesort |
|
|
|
|
|
Quicksort |
|
|
|
|
|
Bucket sort |
|
|
|
|
|
Radix sort |
|
|
|
|
|
Last Modified: