# Bubble Sort Algorithm -With Example

# Introduction

Bubble Sort Algorithm is the sorting algorithm that iterates through the given list and compares consecutive adjacent pairs of elements which swaps them in a pair. it arranges the data in such a way that Smaller elements comes first in ascending order where larger elements comes first in descending order and vice versa. People also recognise it as Sinking sort or comparison sort .

The Smaller elements in the list moves up like a bubble so it is called bubble sort. It is one of the most simplest Sorting Algorithm. It starts comparing the elements one by one and the smaller value moves up. The process continues until all the values are in order and the values of adjacent elements compare with each other and swap the value if necessary. In each iteration, the value compares up to the last unsorted data. Beginners and learners mainly use it. It is easy to implement and is faster for smaller data in an array but for larger data sorting data using bubble sort is difficult. It is so because it takes long time to process for larger data. Because of that is simple to understand but is difficult to execute in real time programming. The data can be in ascending or descending order.

## Technology used

- Python
- Drawing Tool

## Features

- Simple and easy to understand.
- easier way to sorted the given data.
- Easy to use and can be easily operated by beginners.
- Fast and efficient to use.

## Functions

- The values should be in an Array.
- it will be easier for people to sort many data in short period by using Bubble sort

## Things to Know

- You have to download python.
- You must have basic knowledge of Arrays.

## Implementation of Bubble Sort Algorithm

Lets take an example of an array with values {6,1,2,4,3,5}.

Here is the representation of Bubble sort algorithm on how it sorts the array using bubble sort.

These are the data after 1st iteration but the values are not in sorting order. So, To sort them in order 2nd iteration carries out.

Thank you

## Leave a Reply