Download this file.
Please log in if you would like to add comments. | |
1 | def add(word):
| 2 | """ Maintains two global lists - one for the words, and a list called index which has 26 integers, with each integer representing the starting index of the corresponding letter in the main list. For instance, the if index[3] = 12, it means that the index for the first word in main_list beginning with "c" is 12. Everytime a word is added, the main_list is traversed to find out where to insert it alphabetically. The index list is updated correspondingly to show the new starting positions of addresses in main_list"""
| 3 |
| 4 | pass
| 5 |
| 6 |
| 7 |
| 8 | def check(word):
| 9 | """ Checks to see the starting alphabet of the word, then looks up the corresponding letter in index, and finds the starting address of the letter in the main_list. It then serially traverses through the main_list starting at the previously found address. If it doesnt find that word and the next alphabet starts, then it returns false. Else it returns true."""
| 10 |
| 11 | pass
| 12 |
| 13 | def remove(word)
| 14 | """ Removes the word from the list of words. Uses a mechanism like in check to find out the word location. It also updates values in index to reflect new starting addresses."""
| 15 |
| 16 | pass |
|