Bubble Insertion Selection Discuss why insertion sort is the
Bubble Insertion Selection Discuss why insertion sort is the fastest of the three and bubble sort is the worst of the three.
Solution
Insertion sort is fastest than bubble sort.
In bubble sort ,in each pass we used to swap all unordered elements.
Where as in insertion sort we locate the position in sorted list to place for element. So there is only one write operation.
In bubble sort each pass may have more write operations.
That is the reason why insertion sort is faster than bubble sort.
Insertion sort is faster than selection sort because in selection sort we use to traverse complete array to select minimum element.but in insertion sort in some cases we can find correct position without traversing complete sublist.
So insertion sort is faster than bubble sort and selection sort.
