DSA-VerseLearn by watching code run
DashboardData StructuresAlgorithmsVisualizerCORECoding PlaygroundInterview QuestionsComplexity AnalyzerLearning NotesBookmarksLearning ProgressSettings
Instrumented JavaScript implementation · lines sync with the animation

Run to execute this JavaScript code for real (output appears here).

Selection Sort

sorting
29
10
14
37
13
0
1
2
3
4
ComparingSwapping / movingCurrentSorted / finalFound / placed

Ready.

Divides the array into a sorted prefix and an unsorted suffix. Each pass selects the minimum of the unsorted part and swaps it into the next position of the prefix. Press Run (Ctrl + Enter) to animate, or Step forward (F10) to go one event at a time.

1 / 42

Execution

Step

1 / 42

Line (JavaScript)

—

FUNCTION_CALL

Variables

arr[29, 10, 14, 37, 13]
n5
Call stackdepth 0

main (no active function frames)

Operation counters

No counted operations yet.

Memory (measurable)

Extra variablesn, i, j, minIndex
Auxiliary spaceO(1) — in place

Data structure state

[29, 10, 14, 37, 13]