CSC151 2009F, Class 48: Merge Sort Admin: * No reading for Monday. * I may distribute links to the project images so that we can better discuss project code on Monday. * I hope you have a wonderful Thanksgiving! Overview: * More efficient sorting techniques. * Divide and conquer, revisited. * Merge sort. * Analyzing merge sort. How expensive is insertion sort? * It depends a bit on the ordering of the list * List-based insertion sort, we're best off having the list in what form? * Already sorted * Backwards sorted [The winner] * As we insert each element, we get to "plunk it at the front" * In list-based insertion sort, already sorted is the worst starting point * As we insert each element into the sorted list, we have to go through *everything* already in the sorted list Divide and conquer sorting: * Divide the list into two halves * Sort each half * Join the halves together To split a list * Find the length * (take lst (/ length 2)) * (drop lst (/ length 2))q This is recursive. What's the base case? * A list of length 1 is already sorted