Insertion Sort Multiple choice Questions and Answers (MCQs)

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<

Insertion Sort Multiple choice Questions and Answers (MCQs)

Question 1
How many passes does an insertion sort algorithm consist of?
A
N
B
N-1
C
N+1
D
N2
Aptitude test Questions answers
Question 1 Explanation: 
An insertion algorithm consists of N-1 passes when an array of N elements is given.

Question 2
Which of the following algorithm implementations is similar to that of an insertion sort?
A
Binary heap
B
Quick sort
C
Merge sort
D
Radix sort
Economics Questions answers
Question 2 Explanation: 
Insertion sort is similar to that of a binary heap algorithm because of the use of temporary variable to swap.

Question 3
What is the average case running time of an insertion sort algorithm?
A
O(N)
B
O(N log N)
C
O(log N)
D
O(N2)
GK Questions answers
Question 3 Explanation: 
The average case analysis of a tight bound algorithm is mathematically achieved to be O(N2).

Question 4
Any algorithm that sorts by exchanging adjacent elements require O(N2) on average.
A
True
B
False
Commerce Questions answers
Question 4 Explanation: 
Each swap removes only one inversion, so O(N2) swaps are required.

Question 5
What is the average number of inversions in an array of N distinct numbers?
A
N(N-1)/4
B
N(N+1)/2
C
N(N-1)/2
D
N(N-1)/3
Visual arts Questions answers
Question 5 Explanation: 
The total number of pairs in a list L is N(N-1)/2. Thus, an average list has half this amount, or N(N-1)/4 inversions.

There are 5 questions to complete.

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<