AlgorandSIMULATION v1.0
Sequential Engines(17)
Parallel Engines

Selection Sort

sequentialRAM

An in-place comparison sort that divides the array into sorted and unsorted sections, repeatedly finding the smallest element from the unsorted section and placing it at the end of the sorted section.

SIMULATION STEP PROGRESSStep 1 / 1
SPEED (50%)
SIZE (8)
💡 Tip: Enter integers between 1 and 99. Max size is 15.
Code Workspace
1procedure selectionSort(A: list of items)
2 n := length(A)
3 for i := 0 to n-1 do
4 minIndex := i
5 for j := i+1 to n do
6 if A[j] < A[minIndex] then
7 minIndex := j
8 end if
9 end for
10 if minIndex != i then
11 swap(A[i], A[minIndex])
12 end if
13 end for
14end procedure
Currently highlights executing branch
RUNTIME COST METRICS
Comparisons0
Memory Writes0
Memory Reads0
Elements Swapped0
Computational Model:RAM (Single Core)
Theoretical Bound:O(N²)
Space Complexity:O(1)
Communication Cost:0 (Shared Bus)
THEORETICAL ANALYSIS & RESEARCH

Conceptual Focus: An in-place comparison sort that divides the array into sorted and unsorted sections, repeatedly finding the smallest element from the unsorted section and placing it at the end of the sorted section.

Real-world Industrial Applications:
  • Useful when write cost is highly expensive
  • Academic teaching of fundamental control loops