2 // LZ78 trie data structure
10 typedef struct striebody
15 struct striebody *trie;
20 { triebody trie; // trie
21 heap heaps[256]; // heaps
22 uint nid; // nr of nodes
26 trie createTrie (void);
27 // inserts word[0...] into pTrie and returns new text ptr
28 // insertion proceeds until we get a new trie node
29 uint sizeofTrie(triebody *t);
31 byte *insertTrie (trie pTrie, byte *word/*, ulong *pos*/);
32 // inserts word[0..len-1] into pTrie, with id = id
33 // assumes that no two equal strings are ever inserted
34 void insertstringTrie (trie pTrie, byte *word, uint len, uint id);
36 void destroyTrie (trie pTrie);
37 // represents pTrie with parentheses, letters and ids
38 void representTrie (trie pTrie, uint *parent, byte *letters, uint *ids);