Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^5: Puzzle: The Ham Cheese Sandwich cut.

by BrowserUk (Patriarch)
on Nov 17, 2005 at 22:04 UTC ( [id://509609]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Puzzle: The Ham Cheese Sandwich cut.
in thread Puzzle: The Ham Cheese Sandwich cut.

Yes. The tree would have to be a "multi-dimensional R-B tree"--not that I have the foggiest clue how you would construct one (yet).

Okay, you've satified me on that case, but what about this one.

Two groups of 3 points; one of the first group and two of the second lie on a straight line. The other two points of the first group lie either side of that line ('scuse the crude drawings, but if I can't visualise it, I can't program it:):

+-------------+ | \ | | x x | | \ | | \ | | x . | | \ | | . | +-------------+

No matter where you put the third point of the second group, other than on that line, the problem is insoluble. I think?

The same logic applies to the higher dimensions also. (I think).


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^6: Puzzle: The Ham Cheese Sandwich cut.
by Perl Mouse (Chaplain) on Nov 18, 2005 at 09:42 UTC
    No matter where you put the third point of the second group, other than on that line, the problem is insoluble. I think?
    No. The line you have drawn has one x on the left of the line, and one x on the right of the line - since 1 is not more than half of 3, it correctly divides the set of x points. And no matter where you place the third point, each half-plane (that is, right of the line, or left of the line) contains at most 1 point.

    Points that are on the line are neither to its left, nor to its right.

    Perl --((8:>*

      Okay. Once I know how you want to fudge the inconvenient edge cases, the problem becomes easier :)


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^6: Puzzle: The Ham Cheese Sandwich cut.
by QM (Parson) on Nov 17, 2005 at 23:59 UTC
    I think we have to have a practical definition of which group a point on the line is in.

    You could go with neither, or both (I'd suggest "both").

    Then if you put the 3rd point off the line, that half-plane has 3 points of that color, and the other half-plane has 2 points. "At most" -- well, you can't split a point, so it "at most" must be ceil(n/2).

    On the other hand, choosing "neither" means that one side has 1 point, and the other side has 0, each of which is "at most" n/2. <p. We just have to get the definitions right.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      It's all in the (interpretation of) the wording I guess.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Seems pretty clear to me -- If a point is on both sides of the line going through it, then there are trivial examples (as shown above) where no solution is possible. Indeed, no solution would be possible for any diagram with an odd number of reds or greens -- we have to pass a line through the diagram so that "at most half" of the points are on each side. Take the basic case of one point of each color. Pass the line through them. Counting them both as on both sides of the line, more than half are on each side.

        Thus the puzzle clearly means to count a point on a line as not on the left of the line and not on the right.
      I think we have to have a practical definition of which group a point on the line is in.

      You could go with neither, or both (I'd suggest "both").

      It's neither. Otherwise, there's no way to satisfy the condition that either set contain at most half the points if the set contains an odd number of elements.

      There's an analogy with the partition phase of quicksort: given a pivot, one divides the set of points into three: those points less than the pivot, those point greater than the pivot, and those equal to the pivot. One recurses into the first two groups.

      Perl --((8:>*
        As I explained above, you can adjust the "total" for checking "at most half". Depends on whether you want to count in halves or not.

        Reminds me of that puzzle where siblings inherit a herd of horses.

        A wealthy merchant at his death left his stable of 17 horses to his three sons. He specified that the eldest was to have one half of the horses, the next one-third, and the youngest one-ninth. The three young heirs were in despair, for they obviously could not divide 17 horses this way without calling in the butcher. They finally sought the advice of an old wise friend, who promised to help them.

        She arrived at the stable the next day, leading one of her own horses. This she added to the 17 and directed the sons to make their choices. The eldest took one half of the 18, or nine; the next one-third of the 18, or six; and the youngest, one-ninth of 18, or two. When all 17 of the original horses had been chosen, the old woman took her own horse and departed.

        The catch here is that the willed fractions didn't add up to 1, but to 17/18ths. Going with the "at most half" criteria, it doesn't say that both sides need to add to the total (assumption klaxon blaring). I don't see that it makes any difference whether to include, exclude, or split points on the line.

        -QM
        --
        Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://509609]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found