This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Algorithms Lecture 5: Randomized Algorithms The first nuts and bolts appeared in the middle 1400s. The bolts were just screws with straight sides and a blunt end. The nuts were hand-made, and very crude. When a match was found between a nut and a bolt, they were kept together until they were finally assembled. In the Industrial Revolution, it soon became obvious that threaded fasteners made it easier to assemble products, and they also meant more reliable products. But the next big step came in 1801, with Eli Whitney, the inventor of the cotton gin. The lathe had been recently improved. Batches of bolts could now be cut on different lathes, and they would all fit the same nut. Whitney set up a demonstration for President Adams, and Vice-President Jefferson. He had piles of musket parts on a table. There were 10 similar parts in each pile. He went from pile to pile, picking up a part at random. Using these completely random parts, he quickly put together a working musket. Karl S. Kruszelnicki (Dr. Karl), Karl Trek , December 1997 Dr [John von] Neumann in his Theory of Games and Economic Behavior introduces the cut-up method of random action into game and military strategy: Assume that the worst has happened and act accordingly. If your strategy is at some point determined...by random factor your opponent will gain no advantage from knowing your strategy since he cannot predict the move. The cut-up method could be used to advantage in processing scientific data. How many discoveries have been made by accident? We cannot produce accidents to order. William S. Burroughs, "The Cut-Up Method of Brion Gysin" in The Third Mind by William S. Burroughs and Brion Gysin (1978) 5 Randomized Algorithms 5.1 Nuts and Bolts Suppose we are given n nuts and n bolts of different sizes. Each nut matches exactly one bolt and vice versa. The nuts and bolts are all almost exactly the same size, so we cant tell if one bolt is bigger than the other, or if one nut is bigger than the other. If we try to match a nut witch a bolt, however, the nut will be either too big, too small, or just right for the bolt. Our task is to match each nut to its corresponding bolt. But before we do this, lets try to solve some simpler problems, just to get a feel for what we can and cant do. Suppose we want to find the nut that matches a particular bolt. The obvious algorithm test every nut until we find a match requires exactly n- 1 tests in the worst case. We might have to check every bolt except one; if we get down the the last bolt without finding a match, we know that the last nut is the one were looking for. 1 Intuitively, in the average case, this algorithm will look at approximately n / 2 nuts. But what exactly does average case mean?...
View Full Document
- Spring '09