Objective
This activity is designed to help you understand the step-by-step process of various sorting algorithms by working collaboratively to sort an array and document the steps. By the end of this activity, you’ll have a clear understanding of how the algorithms work and how they differ from each other.
Activity Overview
You will be divided into groups, and each group will be assigned one of the following sorting algorithms:
- Selection Sort
- Insertion Sort
- Bubble Sort
- Merge Sort
Your task is to:
- Sort a provided array using your assigned algorithm.
- Document every step of the sorting process.
- Present your findings to the class.
Time: 15 Minutes
Here is the array you will work with:
The Array
[34, 12, 45, 10, 56, 23, 4, 11]
Instructions
- Sorting the Array
- Perform the sorting algorithm step-by-step on the array.
- After each step, record the current state of the array, highlighting comparisons, swaps, or merges.
- Documenting the Process
- Create a Google Doc titled “Sorting Steps: [Algorithm Name]”.
- Include the following sections in your document:
- Algorithm Name: Title of your assigned algorithm.
- Initial Array: The array at the start.
- Step-by-Step Process: For each step, show the new array, with the elements that change position highlighted.
- Final Array: The fully sorted array.
- Explanation: A brief explanation of how your sorting algorithm works.
- Share Google Doc with instructor: skonjp@kenyon.edu
- Present to the Class
- At the end of the activity, your group will present your Google Doc to the class.
- Explain:
- How the algorithm works.
- Key steps of the sorting process.
- Challenges or observations.
Sorting Algorithm Guidance
Selection Sort
- Find the smallest element in the unsorted portion of the array.
- Swap it with the first unsorted element.
- Repeat for the next smallest element until the array is sorted.
Insertion Sort
- Start from the second element.
- Compare it with elements to its left and insert it into the correct position.
- Repeat for all elements.
Bubble Sort
- Compare adjacent elements and swap them if they are out of order.
- Repeat until no swaps are needed (array is sorted).
Merge Sort
- Recursively divide the array into halves until each subarray has one element.
- Merge the subarrays back together in sorted order.
Expected Deliverables
- A Google Doc containing:
- Step-by-step documentation of the sorting process.
- Final sorted array.
- Brief explanation of the algorithm.
- A class presentation summarizing your findings.
Discussion Questions
- Which algorithm do you think is the most efficient for this array?
- How does the number of comparisons or swaps differ between algorithms?
- How might these algorithms perform differently with larger or already sorted arrays?
