views:

52

answers:

0

I am refactoring this algorithm completely. Basically I am re-implementing the ASP.NET MVC in C++ for another framework. I'm trying to implement a URL matching algorithm and I figured that radix tree would be the best choice for the keys searching because some url prefixes might be shared.
Also searching may be very efficient considering this example:

tree.getPrefix("home/");

This should output all the actions that home can perform.
Also if home is not found it should try to match an inputted pattern in the tree (see ASP.MVC for examples).
If only a part of the URL matches it should use the default.
Is it a good idea to implement it this way?
How would the new algorithm look like?