KnowledgeBoat Logo

Computer Applications

Differentiate between Selection sort and Bubble sort

Java Arrays

57 Likes

Answer

Selection sortBubble 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 SortPerforms more number of swaps to sort the array
Selection Sort is fasterBubble Sort is slower

Answered By

36 Likes


Related Questions