Source Code: https://www.instms.com/data-structure...
In today video session we will learn about the simplest sorting algorithm that is called bubble sort. Bubble sort algorithm is used where the data set is small. It is not suitable for large scale data set because it requires many comparison and swaps to get sorted data. In data structures bubble sort is also important to understand because it gives detail idea about flow of sorting algorithms. In this session we will discuss the following.
1. Bubble Sort Algorithm
2. Bubble Sort Animation
3. Bubble Sort Steps
4. Bubble Sort Time Complexity
5. Bubble Sort Space Complexity
We also provide an animation to understand the steps that are required by bubble sort to sort out the given data set. In bubble sort the adjacent values are compared in each pass and if these values are not in proper order order than these values are swapped. Here we are using swap using third variable named as temp. The worst case of bubble sort required n square comparisons as well as n square swaps. So that this sorting algorithm is only best for small data sets.
Bubble sort is simple to understand and implement.