[prev] [index] [next]

C Version

Comments on this implementation:
  • uses scanf("%s"...) to break input stream into words
  • prefixes are implemented as arrays of malloc'd string buffers
  • since C has no built-in hash tables, we need to implement out own
  • there is a single hash table object called statetab
  • the function lookup provides the only direct access to statetab
  • other functions manipulate the table via pointers to components
  • each hash table entry is a pointer to a linked list of States
  • each State contains a prefix and a pointer to a suffix list
  • suffix lists are linked lists of Suffix nodes