A search engine improves search speed and reduces required memory for a
longest prefix matching (LPM) router that routes packets using IP
addresses. The search engine includes a first bit vector with set bits
corresponding to address ranges. A set bit counter counts the set bits in
the bit vector based on a first portion of the address of the a first
packet. A first next hop table contains first pointers for each of the
set bits. One of the first pointers is selected based on a number of set
bits counted by the set bit counter. For longer addresses, the addresses
are split into address portions. The search engine includes a trie data
structure that has n levels. The n levels of the trie data structure
include nodes representing non-overlapping address space.