Sorting Algorithms Flashcards
1
Q
What is Bubble sort?
A
- Look at the first two and if they are in order don’t change anything otherwise swap them.
- Look at the next two and do the same
and then keep on repeating the process until they are all in order
2
Q
What is a Merge sort?
A
- Splits the list in half
- repeat step 1 until each set has two items
- merge pairs so that each set has two more items and then sort them in order then repeat this step till all of them are in order
3
Q
What is an Insertion Sort?
A
- Look at the second item on the list
- Compare it to all of the items before just incase its the first item and insert the number into the right place
- Repeat step 2 until the last number in the list has been inserted into the correct place