A method and apparatus for searching an electronically stored table of
information including a plurality of table entries and facilitating high
speed searching of a table to provide a longest matching entry. The table
searching method uses at least one memory unit having a table of
information including a plurality of data entries. The table of
information has a plurality of search keys associated with the plurality
of data entries and the plurality of search keys form a tree structure
based on a prefix length for each of the search keys. The plurality of
search keys are expanded such that each of the plurality of search keys
has two lowest level search keys associated therewith that cover a lowest
level of the tree structure. A binary search of the lowest level search
keys is performed based on a search value to determine a longest prefix
match. A data entry of the plurality of data entries is output based on
said longest prefix match. The method is also applicable to routing data
in an internet router where the routing of data packets depends on
address information stored in the table of information.