Timeline for Efficiently searching a list for the position of the closest number to a specified number
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 30, 2017 at 21:58 | answer | added | kglr | timeline score: 5 | |
Apr 13, 2017 at 12:55 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Oct 23, 2013 at 11:14 | vote | accept | Andrew Cheong | ||
Oct 23, 2013 at 6:35 | history | tweeted | twitter.com/#!/StackMma/status/392902020786827264 | ||
Oct 23, 2013 at 5:11 | answer | added | Dr. belisarius | timeline score: 14 | |
Oct 23, 2013 at 5:02 | comment | added | Andrew Cheong |
@Jonie - Currently my implementation (above) returns what Nearest would return by default: a list of all "tied" for the closest. (I don't need any of Nearest 's other features, like closest-within-a-radius, closest-n, etc.)
|
|
Oct 23, 2013 at 5:00 | comment | added | Jonie | thinking about it computationally, you'd need to check every number to determine which one is the closest number. So best you got is O(n). If it's sorted, you obviously can do a lot better by binary search and such. Anyway, what happens if there are multiple instances of the closest number? Do you expect it to take the closest or last? | |
Oct 23, 2013 at 4:46 | history | asked | Andrew Cheong | CC BY-SA 3.0 |