Recall & Review
beginner Click to reveal answer
What is the main idea behind the Selection Sort algorithm?
Selection Sort repeatedly finds the smallest element from the unsorted part and moves it to the beginning, sorting the list step by step.
beginner Click to reveal answer
How many passes does Selection Sort make over the array?
Selection Sort makes n-1 passes over an array of n elements, because after placing n-1 elements, the last one is already sorted.
intermediate Click to reveal answer
What is the time complexity of Selection Sort in the worst case?
The worst-case time complexity of Selection Sort is O(n²), because it uses two nested loops to find the minimum element for each position.
beginner Click to reveal answer
Does Selection Sort require extra memory for sorting?
No, Selection Sort is an in-place sorting algorithm, meaning it sorts the array without needing extra memory beyond a few variables.
beginner Click to reveal answer
Show the first step of Selection Sort on the array [29, 10, 14, 37, 13].
Find the smallest element (10) and swap it with the first element (29). The array becomes [10, 29, 14, 37, 13].
What does Selection Sort do in each pass?
✗ Incorrect
Selection Sort finds the smallest element in the unsorted part and swaps it to the front in each pass.
What is the space complexity of Selection Sort?
✗ Incorrect
Selection Sort sorts the array in place using only a few extra variables, so space complexity is O(1).
How many comparisons does Selection Sort make in total for an array of size n?
✗ Incorrect
Selection Sort makes about n(n-1)/2 comparisons because it compares each element with all others in the unsorted part.
Which of these is true about Selection Sort?
✗ Incorrect
Selection Sort is unstable because swapping can change the relative order of equal elements.
After the first pass of Selection Sort on [5, 3, 8, 4, 2], what is the array?
✗ Incorrect
The smallest element 2 is swapped with the first element 5, resulting in [2, 3, 8, 4, 5].
Explain how Selection Sort works step by step on a small array.
Think about how you would sort cards by picking the smallest each time.
You got /4 concepts.
Describe the time and space complexity of Selection Sort and why it is considered inefficient for large data.
Consider how many comparisons happen as the list grows.
You got /4 concepts.
