The selection sort algorithm generally is the first sorting algorithm that is taught to us. Here in every iteration of the inner loop, the smallest element is replaced with the starting element in each loop. The bubble sort algorithm might look a little bit confusing when we first study it. But here is the easy explanation of it. Here swapping is carried on in two ways. In every iteration of the outer loop, the largest element is found and swapped with the last element in the loop.
|Selection Sort||Bubble Sort|
|Selection sorting is a sorting algorithm where we select the minimum element from the array and put that at its correct position.||Bubble sorting is a sorting algorithm where we check two elements and swap them at their correct positions.|
|Its Time complexity in the Best case is O(N^2)||Its Time complexity in the Best case is O(N)|
|Its Time complexity in the worst case is O(N^2)||Its Time complexity in Worst case is O(N^2)|
|This sorting algorithm uses the selection method||This sorting algorithm uses exchanging method|
|It is an efficient sorting technique.||It is not an efficient sorting technique.|
|This method is faster.||This method is slower.|