Download presentation

Presentation is loading. Please wait.

Published byJakayla Chiles Modified over 3 years ago

1
HandoutLecture 6Binary Search Weighing with a Balance A large container is known to hold 24 oz of nails. The hardware store has a balance, but no weights. Can you measure out 9 oz of nails for a customer? A chemist has a balance and fixed weights of 1, 2, 4, and 8 grams. Show that she can weigh any amount of material from 1 to 15 grams by placing the weights on one side and the material on the other. What is the best set of four fixed weights in the sense of maximizing the range of measurable weights in increments of 1 gram?

2
HandoutLecture 6Binary Search Find the Lighter Counterfeit Coin We have three coins. Two are normal coins; one is a counterfeit coin that weighs less. Identify the counterfeit coin with one weighing on a balance. We have nine coins; eight normal coins and a counterfeit coin that weighs less. Identify the counterfeit with 2 weighings. Generalize: How many weighing with a balance are needed to find a light counterfeit coin among n coins? How should we change the procedures above if the counterfeit coin is known to be heavier than normal ones?

3
HandoutLecture 6Binary Search 12 Coins with 1 Counterfeit: Lighter or Heavier We have 12 coins. Eleven are normal coins; one is a counterfeit coin that weighs less or more than a normal coin. Identify the counterfeit coin and its relative weight with a minimum number of weighings on a balance. Hint: First do it for 3 coins, one of which is a counterfeit, using only two weighing,

4
HandoutLecture 6Binary Search Another Solution to the 12-Coin Puzzle We have 12 coins. Eleven are normal coins; one is a counterfeit coin 1 4 6 10 against 5 7 9 12 2 5 4 11 against 6 8 7 10 3 6 5 12 against 4 9 8 11 Each weighing has three possible outcomes: L -- Left heavier R -- Right heavier B -- Balance 1 2 4 3 5 6 8 7 9 10 12 11 Example: L L B -- Counterfeit coin is among 1, 2, 7, 10 7 is lighter L L Lnp L L B7– L L R L B L L B B L B R L R L L R B L R R B L L B L B B L R B B L B B Bnp B B R B R L B R B B R R R L L R L B R L R R B L R B B R B R R R L R R B7+ R R Rnp

Similar presentations

OK

1 Section 5.1 Analyzing Algorithms Let P be a problem and A an algorithm to solve P. The running time of A can be analyzed by counting the number of certain.

1 Section 5.1 Analyzing Algorithms Let P be a problem and A an algorithm to solve P. The running time of A can be analyzed by counting the number of certain.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on relays and circuit breakers Ppt on fire safety training Ppt online open office Ppt on unity in diversity of india Ppt on solar system for class 3 Ppt on polytene chromosomes drosophila Ppt on topic iso 9000 Ppt on cross cultural differences Ppt on pre ignition problem Ppt on immunization schedule in india