Searching and sorting algorithms

Cards (5)

  • Linear search- each data item is checked from the first to the last, doesn't have to be in order, large list-not very efficient
  • Binary search- has to be in order, middle point of data is selected and compared to target, upper half or lower half is ignored until midpoint is the target
  • Merge sort- divides list into half until each item is seperate, then combines lists together but in the correct order
  • Bubble sort- data elements are swapped if they are not in the correct order, only stops when an iteration is completed with no swaps
  • Insertion sort- compares values in turn, starting with the second value in the list. If this value is greater than the value to the left of it, no changes are made. Otherwise, this value is repeatedly moved left until it meets a value that is less than it. The sort process then starts again with the next value.