Copy and paste is a design error. David Parnas

Bubble sort

Language Java | Level Intermediate | Category Algorithms | August 2, 2015 8:28 pm

Algorithm Problem Description

Bubble sort is a simple sorting algorithm. It compares each item from the array and swap with an adjacent item if they are not in order. The main advantage of bubble sort is an easy implementation. Bubble sort has poor performance and should be avoided in case of a large number of elements in the array.

Write a program to take the un-sorted array and sort the array using bubble sort.



Unsorted array before sorting: [34, 56, 23, 45, 67, 3]
Sorted array After Bubble Sort sorting: [3, 23, 34, 45, 56, 67]



Please login to add comments.