COMPUTER SCIENCE AND ENGINEERING
ALGORITHMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
True
|
|
False
|
|
Either A or B
|
|
None of the above
|
Detailed explanation-1: -Q 13-What is not true about insertion sort? A-Exhibits the worst case performance when the initial array is sorted in reverse order.
Detailed explanation-2: -1. Which of the following is correct with regard to insertion sort? Explanation: During insertion sort, the relative order of elements is not changed. Therefore, it is a stable sorting algorithm.
Detailed explanation-3: -The worst-case (and average-case) complexity of the insertion sort algorithm is O(n²). Meaning that, in the worst case, the time taken to sort a list is proportional to the square of the number of elements in the list. The best-case time complexity of insertion sort algorithm is O(n) time complexity.
Detailed explanation-4: -Insertion sort iterates, consuming one input element each repetition, and grows a sorted output list. At each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain.