Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re (tilly) 4: (Golf) Nearest Neighbors

by tilly (Archbishop)
on Apr 05, 2001 at 00:00 UTC ( #69862=note: print w/ replies, xml ) Need Help??


in reply to (tye)Re2: (Golf) Nearest Neighbors
in thread (Golf) Nearest Neighbors

I think the "search-for" number is a misunderstanding on your part. We are not looking for the number that is closest to the first. We are looking for the pair of numbers, out of all n choose 2 pairs, which are closest together.

So given (1, 5, 7) it would return (5, 7) (or (7, 5)) while (1, 5, 11) would return (1, 5). And you cannot assume that it is presented in increasing order.


Comment on Re (tilly) 4: (Golf) Nearest Neighbors

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-09-17 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls