Computer Science

Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons.

List 1 :

6342219

Python Sorting

3 Likes

Answer

Selection Sort

Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons. NCERT Computer Science Solutions CBSE Class 12
Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons. NCERT Computer Science Solutions CBSE Class 12
Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons. NCERT Computer Science Solutions CBSE Class 12

Bubble Sort

Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons. NCERT Computer Science Solutions CBSE Class 12
Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons. NCERT Computer Science Solutions CBSE Class 12
Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons. NCERT Computer Science Solutions CBSE Class 12

As we can see from the diagrammatic representation above, selection sort performs 2 swaps whereas bubble sort performs 6 swaps. Hence, selection sort is a better sorting technique with respect to the number of comparisons.

Answered By

2 Likes


Related Questions