Trie datastructure suggestions

Hi All,
Its my first post from England, so hope anyone here can help with this assignment.
the program i'm writing now is like a dictionary. i.e, it gets a txt file as input, and for each word in the file - it should ouput all the lines number it appears in. for example- if "boy" appears in line 2,4,7 - it should print:
boy- 2,4,7.

Now, i did it successfully by "Trie" structure. for all words- i store in trie(tree), and for every word(at the leaf) there's linked list for all line numbers. And this is the easy part .

the stuck one is: now I need to search phrase!!(not one word). i mean - if i get as input - "this is a boy" - i want to print all the lines which this phrase appears. got it ? how can i do that ?

Any idea?
You can look for the single words of the sentence
ie: if you find the first, you check to see if it is followed by the second, etc
Topic archived. No new replies allowed.