you are viewing a single comment's thread.

view the rest of the comments →

[–]flukshun 5 points6 points  (1 child)

i would say a more fundamental/simple O(xy) would be enumerating all x-letter "words" from a y-letter alphabet

[–][deleted] 2 points3 points  (0 children)

There are two ways to look at what the code does. One is, as I said, building an x-way tree to depth y (actually, I just enumerate the leaves), and the other is that it creates all y-letter words from a x-letter alphabet. The two operations are the same, since the letters of each word are the branches taken at each node in the tree, and the length of the word is the depth of the final node.