MA/CSSE 473 Day 20 Questions before exam More decrease and Conquer
MA/CSSE 473 Day 20 See announcements from Day 19 HW 8 has been updated for this term Student Questions (especially about upcoming exam) More decrease and conquer
OTHER DECREASE-AND-CONQUER ALGORITHMS Decrease by a constant factor Decrease by a variable amount
Fake Coin Problem We have n coins All but one have the same weight One is lighter We have a balance scale with two pans. All it will tell us is whether the two sides have equal weight, or which side is heavier What is the minimum number of weighings that will guarantee that we find the fake coin? Decrease by factor of two.
Decrease by a Constant Factor Examples that we have already seen: –Binary Search –Exponentiation (ordinary and modular) by repeated squaring –Multiplication à la Russe (The Dasgupta book that I followed for the first part of the course called it "European" instead of "Russian") Example Then strike out any rows whose first number is even, and add up the remaining numbers in the second column.
Decrease by a variable amount Search in a Binary Search Tree Interpolation Search –See Levitin, pp –Also Weiss, Section Median Finding –Find the k th element of an (unordered) list of n elements –Start with quicksort's partition method –Best case analysis