Final Flashcards
bubble sort
considers objects in pairs, swaps them if they’re in wrong order, largest unsorted item bubbles to top
pros of bubble sort
simple to write, little memory is used, easy to understand
cons of bubble sort
takes a very long time with large amounts of data, goes through list several times making it slow
merge sort
divide and conquer, cuts list down into sublists
pros of merge sort
faster for larger lists, has consistent running time
cons of merge sort
uses more memory to store sublists, goes through entire process even if list is sorted
selection sort
repeatedly finds minimum element from unsorted part and puts it at beginning
pros of selection sort
performs well on small lists, does not require additional storage
cons of selection sort
not efficient for large lists
insertion sort
repeatedly scans lists of items, inserting the item into its correct position
pros of insertion sort
simple, good for small lists, requires minimal storage
cons of insertion sort
does not work well w/large lists, does not perform as well as other algorithms
quick sort
divide and conquer, puts list into sublists
pros of quick sort
efficient in dealing w/large lists, no additional storage necessary, sorts lists of any size easily
cons of quick sort
its worst performance is similar to that of bubble sort, insertion, or selection