Sorting Algorithms Flashcards
describe linear search
search list by inspecting each element
describe quicksort
partition array around pivot such that: Left side of pivot contains all the elements that are less than the pivot element Right side contains all elements greater than the pivot
describe merge sort
It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves.
describe insertion sort
builds the final sorted array (or list) one item at a time
what does in place mean
transforms input using no auxiliary data structure
what does stable mean
maintain the relative order of records with equal keys
give the merge sort complexities
worst O(n log n) best O(n log n) average O(n log n) space O(n)
give the insertion sort complexities
worst O(n^2) best O(n) average O(n^2) space O(n)