0
0
DSA Goprogramming~5 mins

Selection Sort Algorithm in DSA Go - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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
intermediate
In Selection Sort, how many times do we swap elements in the worst case?
Selection Sort swaps elements exactly (n-1) times, where n is the number of elements, because it swaps once per pass.
Click to reveal answer
beginner
Show the state of the array after the first pass of Selection Sort on [29, 10, 14, 37, 13].
After first pass, the smallest element 10 is swapped with 29: [10, 29, 14, 37, 13]
Click to reveal answer
intermediate
What is the time complexity of Selection Sort and why?
Selection Sort has time complexity O(n²) because it uses two nested loops: one to select each element and one to find the minimum in the unsorted part.
Click to reveal answer
intermediate
Why is Selection Sort not efficient for large datasets?
Because Selection Sort always does n² comparisons regardless of the initial order, making it slow for large lists compared to faster algorithms like Quick Sort or Merge Sort.
Click to reveal answer
What does Selection Sort do in each pass?
AFinds the smallest element and swaps it with the first unsorted element
BSwaps adjacent elements if they are in wrong order
CDivides the list into halves and sorts each half
DUses a pivot to partition the list
How many passes does Selection Sort make for an array of size n?
An
Blog n
Cn/2
Dn-1
What is the best case time complexity of Selection Sort?
AO(n²)
BO(n log n)
CO(n)
DO(log n)
Which of these is true about Selection Sort swaps?
AIt swaps elements multiple times per pass
BIt swaps only once per pass
CIt never swaps elements
DIt swaps only if the array is already sorted
Which sorting algorithm is generally faster than Selection Sort for large datasets?
ABubble Sort
BInsertion Sort
CQuick Sort
DSelection Sort
Explain how Selection Sort works step-by-step on a small array.
Think about how you would sort playing cards by picking the smallest card each time.
You got /4 concepts.
    Describe the advantages and disadvantages of Selection Sort.
    Consider when you might want to use it despite its slowness.
    You got /4 concepts.