Top MCQs on InsertionSort Algorithm with Answers

Last Updated :
Discuss
Comments

Question 1

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 2

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

Question 3

In a permutation a1.....an of n distinct integers, an inversion is a pair (ai, aj) such that i < j and ai > aj. What would be the worst-case time complexity of the Insertion Sort algorithm, if the inputs are restricted to permutations of 1.....n with at most n inversions?

  • Θ (n2)

  • Θ (n*log(n))

  • Θ (n1.5)

  • Θ (n)

Question 4

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 5

Which is the correct order of the following algorithms with respect to their time Complexity in the best case ?
  • 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 6

Which of the following statements is correct with respect to insertion sort ?
*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 7

Consider the array A[]= {6,4,8,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees , what is the total cost of the insertion sort when element 1 reaches the first position of the array  ?
  • 50
  • 25
  • 75
  • 100

Question 8

What is the best sorting algorithm to use for the elements in array are more than 1 million in general?
  • Merge sort.
  • Bubble sort.
  • Quick sort.
  • Insertion sort.

Question 9

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 10

Which of the following is not a stable sorting algorithm in its typical implementation.

  • Insertion Sort

  • Merge Sort

  • Quick Sort

  • Bubble Sort

There are 13 questions to complete.

Take a part in the ongoing discussion