Le 4 mai 2021, la plateforme Yahoo Questions/Réponses fermera. Elle est désormais accessible en mode lecture seule. Aucune modification ne sera apportée aux autres sites ou services Yahoo, ni à votre compte Yahoo. Vous trouverez plus d’informations sur l'arrêt de Yahoo Questions/Réponses et sur le téléchargement de vos données sur cette page d'aide.

M3
Lv 7
M3 a posé la question dans Science & MathematicsMathematics · il y a 9 ans

Weighing on my mind puzzle?

There are 5 coins, each with a slightly different weight (differences unknown).

You have a 2 pan balance scale, and no weights (ie you can only compare weights).

In just 7 weighings, arrange the coins in order of weight.

2 réponses

Pertinence
  • il y a 9 ans
    Réponse favorite

    The 5 coins might be in any one of 120 different orders.

    7 uses of the scale = 7 bits = enough to distinguish 128 different cases.

    In Volume 3 of Knuth, "Sorting and Searching", he describes a process

    first discovered by H. B. Demuth (Stanford PhD Thesis, 1956).

    He starts by saying,

    "Can five elements be sorted using only seven comparisons?

    The answer is yes, but it is not especially easy to find."

    (And don't forget, this is Knuth speaking, so "not especially easy" means "very difficult".)

    It works as follows:

    1) Compare two coins, call the lighter one A, the heavier one B.

    2) Compare two others, call those two C and D (in order).

    3) Then compare B vs D.

    Suppose D is heavier.

    Then you have A < B < D and C < D.

    4) and 5)

    Next by comparing the last coin to B and then either A or D

    depending on how it compared to B, we know the ordering

    of those 4.

    Which is one of these:

    c1) E A B D

    c2) A E B D

    c3) A B E D

    c4) A B D E

    5 comparisons used.

    Now it's known already that C < D,

    so it takes just two more to determine where C goes.

    c1) E A B D ... C v A and C v E or B

    c2) A E B D ... C v E and C v A or B

    c3) A B E D ... C v B and C v A or E

    c4) A B D E ... C v B and C v A

    Source(s) : http://citeseerx.ist.psu.edu/viewdoc/download?doi=... gave me the reference to Knuth
  • KevinM
    Lv 7
    il y a 9 ans

    First of all, this could easily be done in (5C2) = 10 weighings - weigh each coin against each other coin. So we need to get rid of 3 weighings. That doesn't seem too hard.

    1) First, weigh coins 1-3 against each other and put them in order.

    2) Next, weigh coins 4-5 against each other. That's 4 weighings so far.

    3) Next, weigh coin 4 against 2.

    a) If 4 weighs more than 2, then weigh 4v3 and 5v3, and you're done.

    b) If 4 weighs less than 2, weigh 5v2. If it weighs less, then... not quite.... thinking

Vous avez d’autres questions ? Pour obtenir des réponses, posez vos questions dès maintenant.