Press "Enter" to skip to content

Bubble Sort

Hello, In my previous articles, I wrote about the Insertion and Selection Sort Algorithms. In this article, I will try to make Bubble Sort Algorithm. In the bubble sort, we are finding the bigger item in the array and then change the order, algorithm do these process until the array become orderly. For the give an example, think like that array = [3,1,6,5,7,8,2,4] for the make orderly see the below process.

3,1,6,5,7,8,2,4 -> items compared and algorithm change the order if bigger in the false order.

3,1,6,5,7,8,2,4 -> 3,1,6,5,7,2,8,4 -> 3,1,6,5,2,7,8,4 -> 3,1,6,2,5,7,8,4 -> 3,1,2,6,5,7,8,4 -> 3,1,2,6,5,7,8,4 -> 1,3,2,6,5,7,8,4

Process goes until the array become orderly.

C Code:

Python Code:

You can ask your questions via e-mail or comments.


Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *