CARVIEW |
Top MCQs on InsertionSort Algorithm with Answers
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
- Merge sort > Quick sort >Insertion sort > selection sort
- insertion sort < Quick sort < Merge sort < selection sort
- Merge sort > selection sort > quick sort > insertion sort
- Merge sort > Quick sort > selection sort > insertion sort
Question 3
*Online - can sort a list at runtime *Stable - doesn't change the relative order of elements with equal keys.
- Insertion sort is stable, online but not suited well for large number of elements.
- Insertion sort is unstable and online
- Insertion sort is online and can be applied to more than 100 elements
- Insertion sort is stable & online and can be applied to more than 100 elements
Question 4
- 50
- 25
- 75
- 100
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
- Merge sort.
- Bubble sort.
- Quick sort.
- Insertion sort.
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
Which of the following sorting algorithms has the minimum running time complexity in the best and average case?
Insertion sort, Quick sort
Quick sort, Quick sort
Quick sort, Insertion sort
Insertion sort, Insertion sort
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.