The Premise
Develop a Java algorithm to generate trees of possible numeronyms for a list of phone numbers.
My Design
- Parse Input
- Read dictionary file
- Discard words containing invalid symbols, or containing too many symbols
- Sort words by symbol count, storing each in a separate array
- Sort each array by alphanumeric value
- For every phone number, generate a list of word combinations or "paths". Begin recursive algorithm with min = 0, max = max_word_size:
- If min = max_word_size: save/store the current "path".
- Of min = max: End recursion.
- Find all word matches for the "sub number" of min → max, using binary search on the array of max-min length words
- Example: 4754632 from min=2 to max=6 will return "LINE" "LIME" and "KIND" for the subnumber "5463".
- Of binary search yielded at least one result, recursively call algorithm with minnew = maxold and maxnew = max_word_size
- Recursively call algorithm with minnew = minold-1and maxnew = maxold.
- Output to a file using entered settings, and proper printf formatting
How To Use
This numeronym generator needs to be compiled with javac and run using java. It must be provided with a plain text list of words, separated with whitespace, and a input file of phone numbers, where each phone number is on a newline, and area codes are separated with a space. The generator has a couple of adjustable parameters that can be tweaked in the source code.