Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by jeffguy (Sexton)
on Nov 17, 2005 at 21:52 UTC ( [id://509601]=note: print w/replies, xml ) Need Help??


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

Exactly. If all points lie on the same line, that line is the correct line.

Btw, where I am so far, I may actually end up using some kind of (VERY nonstandard) tree to get from n^2 to n*lg(n). That would make you right :-)
  • Comment on Re^4: Puzzle: The Ham Cheese Sandwich cut.

Replies are listed 'Best First'.
Re^5: Puzzle: The Ham Cheese Sandwich cut.
by BrowserUk (Patriarch) on Nov 17, 2005 at 22:04 UTC

    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.
      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.
      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.
        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:>*

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 22:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found