在Patricia Trie中找到最长前缀搜索的算法/步骤 [英] Algorithm/steps to find Longest Prefix search in Patricia Trie

查看:450
本文介绍了在Patricia Trie中找到最长前缀搜索的算法/步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施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:

http://cpansearch.perl.org/src/PHILIPP/Net-Patricia-1.15_07 /libpatricia/​​patricia.c

这篇关于在Patricia Trie中找到最长前缀搜索的算法/步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆