Algorithm that Generates Unique Serial Number for Each English Word -
For any application, I need to prepare unique serial numbers for each English word.
What is the best way?
Do you have a list of all possible words? If so, start with the first word on 0 and increase the serial from 1 to every word.
If not, then it is an easy way to guarantee that they are unique. Use the term as a serial. For example, ABC = 0x41 0x42 0x43 = 4276803
. As suggested in the comments there are other methods (though, more work is required), such as compressing the first words, for example, Huffman
It definitely gets awkward with long words: for example,
pneumonoultramicroscopicsilicovolcanoconiosis will require approximately 100 points.
Otherwise you can use a hash, but there is no guarantee that it will be unique to all English words.
Comments
Post a Comment