2.1 Insertion sort Flashcards

1
Q

insertion sort

A

examines each data item in turn and moves it to its correct position

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

stages of insertion sort

A
  • the first item is made into the ordered list
  • the first item of the unordered list is compared against all the items in the ordered list to determine where it fits
  • repeats until all items have been ordered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A student has stored their scores in a list: 7 5 3 6 8 10 9 4

Show the stages of an insertion sort when applied to this data [5]

A

*5 *7 3 6 8 10 9 4
*3 5 7 6 8 10 9 4
3 5 *6 7 8 10 9 4
3 5 6 7 8 10 9 4
3 5 6 7 8 9 10 4
3 5 6 7 8 *9 10 4
3 *4 5 6 7 8 9 10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Show the stage of an insertion sort when used to sort the following list of names into ascending order

Mai Devi Sanjita Maalik Catherine Jane [5]

A

….

ends with the list in order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly