This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var itertools = require("itertools"); | |
| var words = new Object(); | |
| var real_words = new Object(); | |
| fs.readFile('/usr/share/dict/words', function(err, data) { | |
| var infile = data.toString().toLowerCase().split("\n"); | |
| for(i = infile.length -1;i>=0;i--) { | |
| words[infile[i]] = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use Algorithm::Permute; | |
| my %words = (); | |
| my %real_words = (); | |
| open(MYFILE,"/usr/share/dict/words"); | |
| while (<MYFILE>) { | |
| chomp; | |
| $words{lc($_)} = undef; | |
| } | |
| close(MYFILE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| ini_set('memory_limit', '-1'); | |
| function permutation($arr, $temp_string, &$collect) { | |
| if ($temp_string != "") | |
| $collect []= $temp_string; | |
| for ($i=0; $i<sizeof($arr);$i++) { | |
| $arrcopy = $arr; | |
| $elem = array_splice($arrcopy, $i, 1); // removes and returns the i'th element |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| from itertools import permutations | |
| from sets import Set | |
| def lo(item): | |
| return item.lower() | |
| word =sys.argv[1] | |
| file = open('/usr/share/dict/words') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark' | |
| puts Benchmark.measure{ | |
| words = {} | |
| real_words = {} | |
| for infile in File.read("/usr/share/dict/words").downcase.split("\n") do | |
| words[infile] = true | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| from itertools import permutations | |
| words = {} | |
| real_words = {} | |
| for line in open('/usr/share/dict/words').read().split("\n"): | |
| words[line.lower()] = True | |
| for i in range(sys.argv[1].__len__()): |