SortingLab

Selection sort

How it works

Selection Sort finds the smallest element in the list and moves it to the correct position, one step at a time, like selecting the best items from a messy shelf.

  • πŸ”Ή Search through the list to find the smallest item β†’ Swap it with the first unsorted position β†’ Repeat until sorted.

  • πŸ”Ή Best & worst case: Always O(nΒ²) since it searches the entire list every time.

  • πŸ”Ή Why learn it? It's easy to understand and doesn't need extra memory.

πŸ‘€ Think of it as: Picking the shortest friend in a line and moving them to the front.

How it works in code


                        

How to play

Goal: Find and move the smallest element into the correct position.

Buttons:

  • Next ⏭️ β†’ Move through the list to find the smallest element.

  • Select 🎯 β†’ Marks the smallest element found.

  • Move πŸ”„ β†’ Moves the selected element to the correct position on the left.

  • Submit βœ… β†’ Checks if the list is fully sorted.

πŸ‘€ Tip: Once an element is sorted, it turns green and becomes part of the final list!

Game options

Choose game preferences:

Choose game mode:

Choose game difficulty (amount of elements):

Time:

0:60

Lives:

❀️❀️❀️

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Game over!