Practice
Bubble Sort an Array
2024/Feb/Mar·Variant 2
HARDAlgorithms
Sort an array of 5 numbers into ascending order using bubble sort.
Input: 5 numbers. Output: The 5 numbers sorted in ascending order, each on a new line.
Example:
Input: 50
20
10
40
30
Output: 10
20
30
40
50
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Random order
Inputs: 50, 20, 10, 40, 30
Expected: 10
20
30
40
50
Test 2: Already sorted
Inputs: 1, 2, 3, 4, 5
Expected: 1
2
3
4
5
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade