COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Identify the types of sorting that is slowest.
|
Bubble sort
|
|
Selection sort
|
|
Quick sort
|
|
Merge sort
|
Explanation:
Detailed explanation-1: -With a worst-case complexity of O(n^2), bubble sort is very slow compared to other sorting algorithms like quicksort. The upside is that it is one of the easiest sorting algorithms to understand and code from scratch.
Detailed explanation-2: -Experiments by Astrachan sorting strings in Java show bubble sort to be roughly one-fifth as fast as an insertion sort and 70% as fast as a selection sort.
Detailed explanation-3: -On average, the bubble sort performs poorly compared to the insertion sort. Due to the high number of swaps, it’s expected to generate twice as many write operations and twice as many cache misses.
There is 1 question to complete.