Pseudocode Compiler
Practice

Bubble Sort

HARDAlgorithms

Read an integer N (1 ≤ N ≤ 8), then read N integers. Sort them in ascending order using bubble sort and output them one per line.

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
        34
        25
        12
        22
Output: 12
        22
        25
        34
        64
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Unsorted 5 numbers
Inputs: 5, 64, 34, 25, 12, 22
Expected: 12 22 25 34 64
Test 2: 3 numbers
Inputs: 3, 10, 5, 8
Expected: 5 8 10
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade