COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Separates a list of data into different collections of data which are sorted and gathered back into a list
|
|
Goes through a list of data a number of times and compares two items that are side by side to each other to see which is out of order
|
|
Goes through a list, comparing two items that are side by side, and continues to move one value until it is in the correct place.
|
|
None of the above
|
Detailed explanation-1: -Q. What does an insertion sort do? Goes through a list, comparing two items that are side by side, and continues to move one value until it is in the correct place.
Detailed explanation-2: -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.
Detailed explanation-3: -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-4: -Insertion sort is a sorting algorithm that places an unsorted element at its suitable place in each iteration. Insertion sort works similarly as we sort cards in our hand in a card game. We assume that the first card is already sorted then, we select an unsorted card.
Detailed explanation-5: -Insertion sort is simple sorting algorithm. It works in the same way as we (teachers) arranges answer sheets of students according to their roll number. This algorithms simply divides the list into two parts ie sorted (left side) and unsorted(right side).