you are here->home->Class 12->Insertion Sort
Insertion Sort
1)Consider the following list and what is the status of the array after the fourth pass when we use the insertion sort? List elements are: 20, 16, 12, 8, 4, 1

2)What is the number of iterations needed for Insertion Sort to arrange a list of 8 elements when they are initially arranged in reverse order?

3)If the list A contains the items 10, 4, 7, 23, 67, 12 and 5 in that order, what will be the resultant list A after third pass of insertion sort?

4)As part of the maintenance work, you are entrusted with the work of rearranging the library books in a shelf in proper order, at the end of each day. The ideal choice will be ____.

5)Which algorithm out of the following options uses the least number of comparisons (among the list elements) to sort below array in ascending order? List = [22, 33, 44, 67, 71, 73, 88, 92]

6)Which of the following is TRUE of the time complexity of the insertion sort algorithm to sort a list of ‘n’ integers?

7)“Insertion sort works better when array is almost sorted“

8)What are the basic loops required to perform an insertion sort?

9)What will be the output of the following code part?
def insertion Sort(arr):
if (n := len(arr)) <= 1:
for i in range(1, n):
key = arr[i]
j = i - 1
while j <= 0 and key < arr[j]
arr[j + 1] = arr[j]
j = 1
arr[j + 1] = key
arr = [12, 11, 13, 5, 6]

10)Fill in the blanks with suitable choice.
mark first element as sorted
for each unsorted element X
'extract' the element X
for j <- lastSortedIndex down to 0
if current element j > X
move sorted element to the right by
break loop and insert X here
end insertionSort