Bubble sort algorithm and Selection Sort Algorithm Knowledge
Check:
Bubble Sort
- What are the correct intermediate steps of the following data set
when it is being sorted with the bubble sort? 15,20,10,18
- A. 15,10,20,18 – 15,10,18,20 – 10,15,18,20
- B. 10,20,15,18 – 10,15,20,18 – 10,15,18,20
- C. 15,20,10,18 – 15,10,20,18 – 10,15,20,18 – 10,15,18,20
- D. 15,18,10,20 – 10,18,15,20 – 10,15,18,20 – 10,15,18,20
- In a bubble sort structure, there is/are?
- A. A single for loop
- B. Three for loops, all separate
- C. A while loop
- D. Two for loops, one nested in the other
- What is the maximum number of comparisons if there are 5 elements in
array x?
Answers for the Bubble sort:
- A
- D
- A
Selection Sort Portion
- What are the correct intermediate steps of the following data set
when it is being sorted with the Selection sort? 15,20,10,18
- A. 10,20,15,18 – 10,15,20,18 – 10,15,18,20
- B. 15,20,10,18 – 15,10,20,18 – 10,15,20,18 – 10,15,18,20
- C. 15,18,10,20 – 10,18,15,20 – 10,15,18,20 – 10,15,18,20
- D. 15,10,20,18 – 15,10,18,20 – 10,15,18,20
- In a selection sort structure, there is/are?
- A. Two separate for loops
- B. Three for loops, all separate
- C. Two for loops, one nested in the other
- D. A for loop nested inside a while loop
- Which one of the following is the first step in a selection sort
algorithm?
- A. The minimum value in the list is found
- B. The maximum value in the list is found
- C. Adjacent elements are swapped
Answers for the selection Sort:
- A
- C
- A