我正在实施Patricia尝试IP前缀查找,我可以让代码用于完全密钥匹配,但是遇到前缀搜索的问题,当是其他密钥的前缀的密钥时,喜欢:
I am implementing Patricia tries for IP prefix lookup, I could get the code working for complete key match, but facing problems with prefix search, when there are keys which are prefixes of other keys, like:
1.2.3.0 1.2.0.0在上述情况下,任何人都可以帮助我使用前缀搜索算法我应该将它们视为单独长度的键(即/ 24和16) ?
Can anyone help me with the algorithm for prefix searches in the above case Should I consider these as keys of separate length (i.e, /24 and 16) ?
推荐答案看看Net-Patricia。这是Patricia trie用于查找IP地址的实现。接口是perl,但底层代码在C中。这是一个链接,但许多CPAN归档应该有它:
Take a look at Net-Patricia. This is an implementation of a Patricia trie to look up IP addresses. The interface is perl, but the underlying code is in C. Here is a link, but many CPAN archives should have it:
cpansearch.perl/src/PHILIPP/Net-Patricia-1.15_07 /libpatricia/patricia.c
更多推荐
在Patricia Trie中找到最长前缀搜索的算法/步骤
发布评论