Question 1
Consider an array of elements arr[5]= {5,4,3,2,1} , what are the steps of insertions done while doing insertion sort in the array.
4 5 3 2 1
3 4 5 2 1
2 3 4 5 1
1 2 3 4 5
5 4 3 1 2
5 4 1 2 3
5 1 2 3 4
1 2 3 4 5
4 3 2 1 5
3 2 1 5 4
2 1 5 4 3
1 5 4 3 2
4 5 3 2 1
2 3 4 5 1
3 4 5 2 1
1 2 3 4 5
Question 2
Question 3
*Online - can sort a list at runtime *Stable - doesn't change the relative order of elements with equal keys.
Question 4
Question 5
The auxiliary space of insertion sort is O(1), what does O(1) mean?
The memory (space) required to process the data is not constant.
It means the amount of extra memory Insertion Sort consumes doesn't depend on the input. The algorithm should use the same amount of memory for all inputs.
It takes only 1 kb of memory.
It is the speed at which the elements are traversed.
Question 6
Question 7
Which sorting algorithm will take least time when all elements of input array are identical? Consider typical implementations of sorting algorithms.
Insertion Sort
Heap Sort
Merge Sort
Selection Sort
Question 8
Question 9
Which of the following is not a stable sorting algorithm in its typical implementation.
Insertion Sort
Merge Sort
Quick Sort
Bubble Sort
Question 10
What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search?
N
N*log(N)
N2
N*log(N)2
There are 13 questions to complete.