⌘K
Flycodx

Selection Sort

Selection Sort

EasySorting88% accepted

Implement Selection Sort: repeatedly find the minimum element from the unsorted part and place it at the beginning. This O(N²) algorithm is easy to understand and implement — perfect for beginners learning how sorting works from scratch.

Approach

Given N integers, sort them in ascending order using selection sort and print the result.

Input

5 64 34 25 12 22

Output

12 22 25 34 64
solution.py
Loading editor...
Test 1
Test 2
Test 3

Press Run to test your custom input, or Submit to judge against all test cases.

Sign in to continue

Create a free account to run code, submit solutions and track progress.

  • Free forever — no credit card
  • 10+ languages with live execution
  • Points, streaks & leaderboards
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3