COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list? 4 5 9 6 2 7 4 5 6 2 7 9 4 5 2 6 7 9
|
Bubble Sort
|
|
Selection Sort
|
|
Insertion Sort
|
|
None of the above
|
Explanation:
Detailed explanation-1: -The algorithms we will cover are: Bubble sort. Selection sort. Merge sort.
Detailed explanation-2: -Bubble Sort This sorting algorithm is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. If we have total N elements, then we need to repeat the above process for N-1 times.
Detailed explanation-3: -The algorithm needs one whole pass without any swap to know it is sorted.
Detailed explanation-4: -The selection sort improves on the bubble sort by making only one exchange for every pass through the list.
There is 1 question to complete.