Hide text Hide pseudo-code | |
Insert the list of words one at a time into the initially empty trie. Some additional problems. | // p is a pointer to the root of the Common Trie structure // A is the string to be inserted // n is the length of A TRIE-INSERT(p, A, n) 1 for i := 1 to n do 2 if p->C[ A[i] ] = NIL then 3 construct a new node in which: node->C[i] := NIL, bit := FALSE 4 p->C[ A[i] ] := node 5 p := p->C[ A[i] ] 6 p->bit := TRUE |