Computer Applications
Differentiate between Selection sort and Bubble sort
Java Arrays
59 Likes
Answer
Selection sort | Bubble sort |
---|---|
Selection Sort selects the smallest element from unsorted sub-array and swaps it with the leftmost unsorted element. | Bubble Sort compares adjacent elements and swaps them if they are in wrong order. |
Performs lesser number of swaps to sort the same array relative to Bubble Sort | Performs more number of swaps to sort the array |
Selection Sort is faster | Bubble Sort is slower |
Answered By
36 Likes