A method of storing addresses in a database comprising generating original
prefixes representing the addresses to be stored in the database. The
prefix lengths are determined dynamically. Reduced prefixes are generated
by collapsing or expanding the original prefixes such that a number of
reduced prefixes is less than a number of original prefixes. The reduced
prefixes are stored in the database.