|
|
|
|
|
by tmoertel
4663 days ago
|
|
I've used prefix trees to represent matching rules for network-routing rulesets. They're also handy when you need to compute intersections because you can perform a parallel depth-first search over two prefix trees and prune from the search any nodes that don't have a corresponding node in the other tree. For a fun example of this last application, there was a recent Google Code Jam problem called "Alien Languages" [1]. My solution [2] basically counts the leaf nodes in the intersection of two prefix trees. (Note that we can compute the count on the fly during the search and need not actually construct the intersection.) [1] http://code.google.com/codejam/contest/90101/dashboard#s=p0 [2] https://github.com/tmoertel/practice/blob/master/google-code... |
|