Recall & Review
beginner
What is the main idea behind the Selection Sort algorithm?
Selection Sort repeatedly finds the smallest element from the unsorted part and swaps it with the first unsorted element, growing the sorted part step by step.
Click to reveal answer
beginner
How many passes does Selection Sort make through the array?
Selection Sort makes n-1 passes through an array of n elements, because after placing n-1 elements, the last one is already sorted.
Click to reveal answer
intermediate
What is the time complexity of Selection Sort in the best, average, and worst cases?
Selection Sort has a time complexity of O(n²) in all cases because it always compares each element with the rest, regardless of initial order.
Click to reveal answer
beginner
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.
Click to reveal answer
intermediate
Why is Selection Sort not efficient for large datasets?
Because Selection Sort always does n² comparisons, it becomes slow for large datasets compared to faster algorithms like Quick Sort or Merge Sort.
Click to reveal answer
What does Selection Sort do in each pass?
✗ Incorrect
Selection Sort finds the smallest element in the unsorted part and swaps it with the first unsorted element in each pass.
How many swaps does Selection Sort perform in the worst case?
✗ Incorrect
Selection Sort performs exactly n-1 swaps because it swaps once per pass after finding the minimum.
Which of these is true about Selection Sort's space complexity?
✗ Incorrect
Selection Sort sorts the array in-place and uses only a few variables, so it has constant extra space.
What is the best case time complexity of Selection Sort?
✗ Incorrect
Selection Sort always does n² comparisons, so its best case time complexity is O(n²).
Which sorting algorithm is generally faster than Selection Sort for large arrays?
✗ Incorrect
Quick Sort is generally faster than Selection Sort for large arrays due to better average time complexity.
Explain step-by-step how Selection Sort sorts the array [4, 2, 7, 1].
Think about how the smallest number moves to the front each time.
You got /4 concepts.
Describe why Selection Sort is considered an in-place sorting algorithm and what that means for memory use.
Focus on how the array is changed directly.
You got /4 concepts.