Skip to content
CampusEduX

Bubble Sort

Easyjavapythonccppjavascript

Sort an integer array in ascending order using the Bubble Sort technique — repeatedly compare neighbouring elements and swap them when they are in the wrong order. The judge checks the final sorted output.

Input Format

The first line contains an integer N. The second line contains N space-separated integers.

Output Format

Print the N integers in ascending order, separated by single spaces, on one line.

Related Problems

  • Linear Search
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Binary Search
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • First Occurrence in Sorted Array
    Easy · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...