Computer Science

Consider the following lists:

List 1:

235711

List 2:

117532

If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation.

Python Sorting

4 Likes

Answer

Diagrammatic representation of the sorting of List 1 and List 2 using Insertion sort is shown below:

Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12
Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12
Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12
Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12
Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12
Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12
Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12
Consider the following lists List 1 and List 2. If the lists are sorted using Insertion sort then which of the lists List 1 or List 2 will make the minimum number of comparisons ? Justify using diagrammatic representation. NCERT Computer Science Solutions CBSE Class 12

From the diagrams, we can clearly see that List 1 requires no swaps, while List 2 requires multiple (10) swaps during the insertion sort process. Therefore, List 1 makes the minimum number of comparisons and swaps when sorted using insertion sort.

Answered By

3 Likes


Related Questions