Selection Sort VisualizerO(N²) Unstable

LeetCode #75
Comparisons0
Swaps0
Accesses0
Step 1 / 0
64
[0]
25
[1]
12
[2]
22
[3]
11
[4]
45
[5]
90
[6]
38
[7]
Code Execution

💡 Selection Sort in Layman's Terms

Selection Sort acts like a Min-Hunter! It scans the unsorted list from start to finish to find the absolute smallest item, then places it straight into its final spot at the front.

How it Works Step-by-Step:
  • 1Find the Smallest: Walk through all unsorted numbers and keep track of which one is the smallest.
  • 2Swap the Champion: Swap that smallest number into the next open slot at the front of your sorted section.
  • 3Lock & Repeat: Lock that smallest number in place and repeat the hunt for the rest of the list!
👟 Real-World Analogy: Organizing a Shoe Closet by Size

Imagine having a messy pile of shoes on your bedroom floor. You look through the entire pile, pick out the single smallest shoe (size 5), and place it on the far-left shelf. Then you scan the remaining pile for the next smallest shoe (size 6) and place it right beside it. You repeat this until every shoe is neatly arranged from smallest to largest!

State Variables
i0
j0
minIdx0
n8
Time: O(N²)Space: O(1)
LeetCode #75