[erlang-questions] Longest prefix match
Thu Nov 29 23:19:53 CET 2007
A couple of questions regarding 'lpm' algorithm if anyone has any
experience with this.
What would be the most elegant and efficient way for LPM ? For
example,we have some list of numbers:
and the desired number for example:
I guess the most efficient way would be to use some sort of 'tree' and
traverse each number from the beginning of destination number and check
it in number's list and if we can't match N position to claim it to be
the longest prefix match ?
Second question is the same as question one,but implies that to have
some additional data with prefix (route,price,user_id,etc.),what would
be algorithm looks like in this situation ? For example:
number is 550123555666,100 ,the problem would be to find LPM for
specific price (100),in this case there's no unique prefix,but there's
unique prefix+price 'object'.
Anybody had any experience with this issues ?
More information about the erlang-questions