in reply to Re^2: Search a hash for closest match
in thread Search a hash for closest match
Profile - like the great Knuth said, "Premature optimization is the root of all evil."
Based upon the specs you give in Re^2: Search a hash for closest match, I would expect that linear search is not even remotely your optimal solution, and that using Perl's sort (Merge sort) followed by binary search is probably pretty derned good. However, better than fast code is functional code. I would highly recommend developing your script with a very simple bit of logic like this and small data sets, and improving the search algorithm later in the development cycle once it becomes necessary. YMMV.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Search a hash for closest match
by aquinom (Sexton) on Nov 01, 2011 at 18:06 UTC | |
by kennethk (Abbot) on Nov 01, 2011 at 18:47 UTC |