.net - I need to store '/' separated strings in a tree-like structure in C#, how should I do it? -
i trying store parts of long string in efficient tree-like structure, have searched of implementations searching within words... let me try explain mean example, if have:
/potato/carrot/tomato /potato/carrot/pea /potato/lettuce
my initial thoughts should this
potato - carrot -tomato -pea - lettuce
and far have searched, efficient search trees (such dawg , tries) storing words characters , not sure how should go it. ideas?
thanks lot in advance!
edit: far persistence concerned, don't need store tree thought of keeping in memory long program running.
edit2: far storing of children concerned, ended using hybriddictionaries, more efficient dictionaries , works pretty fast now, lot guys!
to keep in memory, might use pattern encountered:
class vegetable : dictionary<string, list<vegetable>>
depending on want (search, count, sort) can implement helper methods inside class.
Comments
Post a Comment