Fine, Java MIGHT be a good example of what a programming language should be like. But Java applications are good examples of what applications SHOULDN’T be like. pixadel

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.

Output

          	        
          	        

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


          	        
          	        				    


Comments



Please login to add comments.