Bubble Sort is an algorithm that is used to sort
N elements that are given in memory for eg: an Array with
N number of elements. Bubble Sort compares all the elements one by one and sorts them based on their values.
We have a detailed tutorial covering How Bubble Sort Works, and we strongly recommend you go through it to understand the functioning of the bubble sort algorithm, before going over the code below.
We have used the python list for implementing the insertion sorting technique. You can change the code, as you like.
We can improve Bubble Sort and make it more efficient, here is the tutorial for Efficient Bubble Sort.