Balanced search trees Balanced search tree a search-tree data structure for which a height of o(g n)is guaranteed when implementing a dynamic set of n items
a weakness of hashing Problem: For any hash function h, a set of keys exists that can cause the average access time of a hash table to skyrocket An adversary can pick all keys from tkeU: h(k)=i for some slot i IDEA Choose the hash function at random independently of the keys
Order statistics Select the ith smallest of n elements(the element with rank i i=l: minimum, .i=n: marimum, i=L(n+1)/2]or[(n+1)/2 median Naive algorithm: Sort and index ith element Worst-case running time =o(n Ig n)+o(1 o(nIg n using merge sort or heapsort(not quicksort) c 2001 by Charles E Leiserson
Quicksort Proposed by C. A.R. Hoare in 1962 Divide-and-conquer algorithm Sorts“ in place”( like insertion sort, but not like merge sort Very practical(with tuning)
Solving recurrences The analysis of merge sort from Lecture I required us to solve a recurrence Recurrences are like solving integrals erential equations, etc o Learn a few tricks Lecture 3: Applications of recurrences