Practice
Selection Sort
HARDAlgorithms
Read an integer N (1 ≤ N ≤ 8), then read N integers. Sort them in ascending order using selection sort and output them one per line.
Selection Sort: For each position i from 1 to N-1, find the minimum value in positions i to N, then swap it into position i.
Input: N on the first line, then N integers one per line. Output: The sorted integers in ascending order, one per line.
Example:
Input: 5
64
25
12
22
11
Output: 11
12
22
25
64
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Unsorted 5 numbers
Inputs: 5, 64, 25, 12, 22, 11
Expected: 11
12
22
25
64
Test 2: 3 numbers
Inputs: 3, 3, 1, 2
Expected: 1
2
3
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade