No such thing as a small change PerlMonks

### Re: Re: Re: Comparing 2-D co-ordinates

by aging acolyte (Pilgrim)
 on Jul 31, 2003 at 15:35 UTC ( #279618=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Comparing 2-D co-ordinates
in thread Comparing 2-D co-ordinates

Chris,

Thanks for helping clarify my problem. I want to find the set of discrete hits that gives me the best coverage (if that make sense?).

In your example above (ah the beauty of acsii graphics) I would like to pick the two shorter examples as combined they give me a higher overall coverage.

I apologise for any confusion that I am causing - I am having a bad day - too hot and sticky in here!

A.A.

Replies are listed 'Best First'.
Re: Re: Re: Re: Comparing 2-D co-ordinates
by BrowserUk (Pope) on Jul 31, 2003 at 16:07 UTC

Not as neat as my first attempt as this requires a sort, but then, maybe this one actually does what you want:)

Output

P:\test>279587-3 cover = 13.0% Using: NM_176827 621 710 NM_176827 618 692

I've also got a version that does this using vec instead of substr, which saves 7/8 of the space, but runs much more slowly.

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Re**4: Comparing 2-D co-ordinates
by belg4mit (Prior) on Jul 31, 2003 at 15:47 UTC
You want the to take the smallest number of your original segments which, combined, cover as much of the range as possible, with no overlaps. This sounds like a solved problem. ie; check some algorythm books/websites

--
I'm not belgian but I play one on TV.

Create A New User
Node Status?
node history
Node Type: note [id://279618]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2018-04-20 19:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (78 votes). Check out past polls.

Notices?