COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Bubble Sort
|
|
Selection Sort
|
|
Insertion Sort
|
|
None of the above
|
Detailed explanation-1: -Which sorting algorithms may make multiple swaps per pass? Bubble sort may make multiple swaps in a single pass.
Detailed explanation-2: -This algorithm is called selection sort because it repeatedly selects the next-smallest element and swaps it into place.
Detailed explanation-3: -The algorithm needs one whole pass without any swap to know it is sorted.
Detailed explanation-4: -The bubble sort has a space complexity of O(1). The number of swaps in bubble sort equals the number of inversion pairs in the given array.
Detailed explanation-5: -A bubble sort algorithm goes through a list of data a number of times, comparing two items that are side by side to see which is out of order. It will keep going through the list of data until all the data is sorted into order. Each time the algorithm goes through the list it is called a ‘pass’.