Card 0 of 3
Which of the following statements explains insertion sort?
Insertion sort removes an element from a list, checks the values adjacent to it to see if it is greater or smaller, until it finds the position where the number to the left is smaller and the number to the right is larger and places it there.
Compare your answer with the correct one above
{1, 9, 5, 4, 2, 0, 4}
What would the set of numbers look like after four iterations of Insertion Sort?
Insertion Sort is a sorting algorithm that starts at the beginning of an array and with each iteration of the array it sorts the values from smallest to largest.
Therefore, after four iterations of Insertion Sort, the first four numbers will be in order from smallest to largest.
Compare your answer with the correct one above
Which of the following do we consider when choosing a sorting algorithm to use?
I. Space efficiency
II. Run time efficiency
III. Array size
IV. Implementation language
All of the choices are important when choosing a sorting algorithm. Space and time complexity are the characteristics by which we measure the performance of an algorithm. the array size directly affects the performance of an algorithm. In addition, the language which the algorithm is written in can also affect the performance (for example, insertion sort may run faster in one language versus another, due the way the language was designed).
Compare your answer with the correct one above