Previous Next
0 / 5
Module DEMO-32-107DEMO-C-32

Bubble Sort

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a function bubbleSort that accepts an array and sorts it using the Bubble Sort algorithm.

Constraints

n <= 50

Input Format

n, array

Output Format

Sorted array

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
5
5 1 4 2 8
1 2 4 5 8
Sample #2
Public sample
1
1
1
Sample #3
Public sample
5
10 -10 0 5 -5
-10 -5 0 5 10

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings