Sorting algorithms 3

?
  • Created by: Tomiwaq
  • Created on: 20-04-19 13:30
View mindmap
  • Sorting algorithms
    • Insertion sort
      • Orders the items as it goes
      • Takes each item in turn and puts it in the right place
      • 1) Look at the second item in a list
      • 2) Compare it to all the items before it and insert the number into the right place
      • 3) Repeat 2) for the third, fourth... items until the last number in the list has been inserted into the correct place
    • Advantages to insertion sort
      • It's easy to code
      • Copes very well with small lists
      • All the sorting is done on the original list so less memory is used
      • Very quick on ordered items
      • Very quick at checking if the list is already sorted
    • Disadvantages to insertion sort
      • Best case scenario it requires n-1 comparisons
      • Worst case: n(n-1)/2

Comments

No comments have yet been made

Similar Computing resources:

See all Computing resources »See all Algorithms resources »