.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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -