views:

35

answers:

1
+1  Q: 

Domize algorithm

I'm trying to figure out how http://domize.com codes their site for speed (I'm using C#).

For example, if I search for

[cns][vwl][cns][cns][vwl][cns]

This will search for a 6 letter domain name that is in this order

consonant, vowel, consonant, consonant, vowel, consonant

Resulting in:

babbab babbac babbad babbaf ... zuzzux zuzzuy zuzzuz

Since there are 21 consonants, and 5 vowels (not including "y"), that would mean that there are 21 * 5 * 21 * 21 * 5 * 21 = 4,862,025 possible combinations.

There results are relatively fast, so they can't possibly be looping through all of those results in that short of a time.

Now, I understand that they only show the first 100 at a time, but in order to get those first 100, they have to build at least SOME of the results.

My question is: how do they do it so fast?

My thought was to create an array of arrays. In this case, there would be 6 arrays (because of 6 groups), with the consonant/vowel possibilities in each array. But I didn't know how to loop through those correctly to build the domains.

I'm sure there is a faster/better way, like maybe hash tables or matrices or something, but I don't know enough about those to figure it out on my own.

If anybody could provide C# code, I would really appreciate it!

Thanks!

A: 

I would guess that it's backed by some variant of a trie .

Ani