in reply to Comparing Lines within a Word List
So you have a looming deadline and no idea how to solve your problem (every CS problem can be solved "using regular expressions in a Perl script"), so you come here to ask us to do your homework for you... well today is your lucky day :-P
My first thought was "spell checker", so I investigated how they work. Apparently one possible implementation is the use of a Trie. I've never worked with a trie before, so I decided to use this chance to try it out. Since it's the first time I'm working with tries, the code might have some bugs. I compared it to a plain, brute-force linear search regex match. In my first tests, the trie data structure takes roughly 5x the memory (as reported by Devel::Size), but on large word lists I saw a 100x to 700x speedup. (Note: My implementation of AnomalousMonk's xor+tr search seems to be roughly twice as fast as the regex implementation.)
If you want to understand what's going on in the code, the book Learning Perl is a good start, as is perldsc. Also, ask here.
(Protip: Don't get thrown out of your class or school for plagiarism and cite your sources.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing Lines within a Word List
by dominick_t (Acolyte) on Apr 27, 2016 at 16:19 UTC | |
by poj (Abbot) on Apr 27, 2016 at 16:40 UTC | |
by Anonymous Monk on Apr 27, 2016 at 16:40 UTC |