# US 7,610,271 B2 · Method and apparatus for performing a binary search on an expanded tree

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 7,610,271 B2
- Document ID: US7610271B2
- Status: Granted
- Kind: B2
- Application number: 10/937,321
- Filed: 2004-09-10
- Published: 2005-02-10
- Granted: 2009-10-27
- Earliest claimed: 2000-05-22
- Assignees: Broadcom Corporation
- Inventors: Jun Cao; Brandon Carl Smith; Eric Ng
- Web page: https://patentgrep.com/patent/US7610271B2

## CPC

- G06F 16/90344: {by using string matching techniques}
- Y10S 707/99933: Query processing, i.e. searching
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y10S: TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS

## Abstract

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.

## Claims

### Claim 1

A table searching method, the method comprising the steps of:
providing at least one memory unit having a table of information including a plurality of data entries, with said table of information having a plurality of search keys associated with the plurality of data entries and with the plurality of search keys forming a tree structure based on a prefix length for each of the search keys;
expanding the plurality of search keys such that each of the plurality of search keys is a lowest level search key or has two lowest level search keys associated therewith that cover a lowest level of the tree structure and bracket a range on said lowest level;
performing a binary search of the lowest level search keys based on a search value to determine a longest prefix match; and
outputting a data entry of said plurality of data entries based on said longest prefix match;
wherein, in the expanding step, a lower valued one of said two lowest level search keys is increased by one to shift said bracketed range.

### Claim 2 (depends on 1)

A table searching method as recited in claim 1 wherein said step of providing at least one memory unit comprises providing at least one memory unit with said table of information having a plurality of search keys based on a subset of Internet Protocol Destination Addresses and wherein said step of performing a binary search comprises performing a binary search of the lowest level search keys based on an input Internet Protocol Destination Address.

### Claim 3 (depends on 2)

A table search method as recited in claim 2 wherein said step of performing a binary search comprises performing a binary search of the lowest level search keys based on an input Internet Protocol Destination Address having a length of 32 bits.

### Claim 4 (depends on 2)

A table search method as recited in claim 2 wherein said step of performing a binary search comprises performing a binary search of the lowest level search keys based on an input Internet Protocol Destination Address having a length of 128 bits.

### Claim 5 (depends on 1)

A table search method as recited in claim 1 wherein said step of providing at least one memory unit comprises providing at least one memory unit having a plurality of virtual tables of information, each having a plurality of data entries, and the method further comprises:
determining a virtual tag based on said search value and setting one of said plurality of virtual tables as said table of information based on said virtual tag.

### Claim 6 (depends on 1)

A table search method as recited in claim 1 wherein said step of performing a binary search comprises performing the binary search in a plurality of stages.

### Claim 7 (depends on 1)

A table search method as recited in claim 1 further comprising updating the data entries in said table of information.

### Claim 8 (depends on 7)

A table search method as recited in claim 7 wherein said step of updating the data entries in said table of information is performed concurrently with said step of performing a binary search.

### Claim 9 (depends on 7)

A table search method as recited in claim 7 wherein said step of updating the data entries in said table of information comprises the steps of:
determining a shift in the data entries when a new data entry is added or when an existing data entry is deleted;
comparing the shift with a predetermined value;
determining an insertion point of said new data entry when said new data entry is added or a deletion point of said existing data entry when said existing data entry is deleted, based on a result of said comparing step; and
inserting the new data entry at the insertion point or deleting a duplicate data entry at the deletion point.

### Claim 10

A table searching apparatus comprising:
at least one memory unit having a table of information including a plurality of data entries, with said table of information having a plurality of search keys associated with the plurality of data entries and with the plurality of search keys forming a tree structure based on a prefix length for each of the search keys;
means for expanding the plurality of search keys such that each of the plurality of search keys is a lowest level search key or has two lowest level search keys associated therewith that cover a lowest level of the tree structure and bracket a range on said lowest level;
means for performing a binary search of the lowest level search keys based on a search value to determine a longest prefix match; and
means for outputting a data entry of said plurality of data entries based on said longest prefix match;
wherein, said expanding means increases a lower valued one of said two lowest level search keys by one to shift said bracketed range.

### Claim 11 (depends on 10)

A table searching apparatus as recited in claim 10 wherein said at least one memory unit comprises at least one memory unit with said table of information having a plurality of search keys based on a subset of Internet Protocol Destination Addresses and wherein said means for performing a binary search comprises means for performing a binary search of the lowest level search keys based on an input Internet Protocol Destination Address.

### Claim 12 (depends on 11)

A table searching apparatus as recited in claim 11 wherein said means for performing a binary search comprises means for performing a binary search of the lowest level search keys based on an input Internet Protocol Destination Address having a length of 32 bits.

### Claim 13 (depends on 11)

A table searching apparatus as recited in claim 11 wherein said means for performing a binary search comprises means for performing a binary search of the lowest level search keys based on an input Internet Protocol Destination Address having a length of 128 bits.

### Claim 14 (depends on 10)

A table searching apparatus as recited in claim 10 wherein said at least one memory unit comprises at least one memory unit having a plurality of virtual tables of information, each having a plurality of data entries, and further comprises:
means for determining a virtual tag based on said search value and means for setting one of said plurality of virtual tables as said table of information based on said virtual tag.

### Claim 15 (depends on 10)

A table searching apparatus as recited in claim 10 wherein said means for performing a binary search comprises means for performing the binary search in a plurality of stages.

### Claim 16 (depends on 10)

A table searching apparatus as recited in claim 10 further comprising means for updating the data entries in said table of information.

### Claim 17 (depends on 16)

A table searching apparatus as recited in claim 16 wherein said means for updating the data entries in said table of information is configured such the updating of data can be performed concurrently with said step of performing a binary search.

### Claim 18 (depends on 16)

A table searching apparatus as recited in claim 16 wherein said means for updating the data entries in said table of information comprises:
means for determining a shift in the data entries when a new data entry is added or when an existing data entry is deleted;
means for comparing the shift with a predetermined value;
means for determining an insertion point of said new data entry when said new data entry is added or a deletion point of said existing data entry when said existing data entry is deleted, based on a result of said comparing step;
means for inserting the new data entry at the insertion point; and
means for deleting a duplicate data entry at the deletion point.
