Re:The Trie: A Neglected Data Structure
by nly on Friday September 13, 2013 @11:23AM
(#6381058)
Did you need full prefix and/or suffix string matching?
[ Parent
| on HN ]
All I needed to do was match prefixes, and now that I think about it, what I actually did was closer to a ternary search tree. The problem was to match operators after matching an identifier, e.g. say the language has these operators ['+', '++', '%'], and you want to be very permissive with what's allowed to be a normal identifier, so "$$#3" is matched as an identifier, but say you have "b++45", then you want to be able to match ++ correctly. There are lots of ways I could've done it, but a trie-like data structure seemed like the easiest way to allow adding more operators easily.