Generates anagrams and sub-anagrams using tries. Supports large words.
A list (dictionary) of possible English words can be downloaded at: https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt.
Given this dictionary and a file containing a list of input words, write a program that can generate all the words that can be formed using a subset of characters from each input word.
For example, if the list of input words is:
['cat', 'dog', 'museam', 'photosyntesis', 'typewriter']
The output file will look like:
['a','c','t','at','ta','act','cat','d', 'dog', ...]
- Clone the repository
git clone https://github.com/calebrotich/anagram-trie.git
and cd into the project foldercd anagram-trie
by default - Ensure that you have
node
installed to be able to usenpm
and to also run the application. Node can be downloaded fromhttps://nodejs.org/en/download/
- Install dependencies
npm install
- Run
node run
to run the application. N/B: First run may be slow depending on internet connection.
Note: Switch the inputs by modifying the array at run.js file
- JavaScript (Node.js, npm)
Script written in response to a challenge by Ideas Come To Life
MIT - Feel free to use in part or whole