COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]


1, 2, 4, 9, 8, 5, 7


1, 2, 5, 9, 8, 4, 7


1, 4, 5, 9, 8, 2, 7


7, 4, 5, 9, 8, 2, 1

Detailed explanation1: Step 1: Set Min to location 0 in Step 1. Step 2: Look for the smallest element on the list. Step 3: Replace the value at location Min with a different value. Step 5: Continue until the list is sorted.
Detailed explanation2: Explanation: Even though the first two elements are already sorted, bubble sort needs 4 iterations to sort the given array.
Detailed explanation3: Example of Selection Sort The smallest number from 5 2 and 1 is 1. So, we replace 10 by 1. The new array is [1, 5, 2, 10] Again, this process is repeated. Finally, we get the sorted array as [1, 2, 5, 10].
Detailed explanation4: In selection sort, the first smallest element is selected from the unsorted array and placed at the first position. After that second smallest element is selected and placed in the second position. The process continues until the array is entirely sorted.