Bubble Sort in Python

Bubble Sort in Python

Here you will learn the program code of Bubble Sort in Python programming.

 

What is bubble sort in python

Bubble Sort is an algorithm that sorts an array by repeatedly looping through the array and swapping adjacent elements if they are out of order. The name comes from the fact that elements with higher values bubble up to the top of the array.

 

Program for bubble sort in python

Output

Enter 5 numbers
Input item : 2
Input item : 4
Input item : 3
Input item : 1
Input item : 9
[‘1’, ‘2’, ‘3’, ‘4’, ‘9’]

 

 

Check out our other Python Programming Examples

 

 

 

Leave a Comment

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

Scroll to Top