Novel data structures, methods and apparatus for finding the longest prefix
match search when searching tables with variable length patterns or prefixes. To
find the exact match or the best matching prefix, patterns have to be compared
a bit at a time until the exact or first match is found. This requires "n" number
of comparisons or memory accesses to identify the closest matching pattern. The
trees are built in such a way that the matching result is guaranteed to be a best
match, whether it is an exact match or a longest prefix match. Using the trail
of all the birds and associated prefix lengths enables determination of the correct
prefix result from the trail. By construction, the search tree provides the best
matching prefix at or after the first compare during walking of the trail or tree.