Search Wiki:
Page for an extremely fast anagram program that is built with the .NET framework. Will find all anagrams contained within any string--of the same length or shorter. Displays results instantly and uses little memory. Very simple and easy to use.

Update October 22 2008

Made algorithm 20% faster by using bitmasks more. Uses DeBruijn positions to find first set bit and letter positions. Times went down from 312 to 250. This is a significant improvement to the implementation.

Update October 20 2008

Use custom Comparison to sort by length instead of LINQ. Much faster sorting. The program probably only runs a tiny bit faster though. Not much else improved.

Update July 27 2008

Big improvements in memory usage. Replaced jagged arrays with a big flat one for 2 MB less memory usage. Entire app now takes 6 MB instead of 8 MB. The DAWG is started up 3.3 times faster as well, for an average of 17 ms instead of 58 ms. (That's an average of many runs.) No lookup performance improvements.

Update July 2 2008

Optimizations with unsafe pointers for startup. DAWG is initialized 57% faster. No big enhancements, just small fixes.
May start up as much as 50% faster! See my new article http://dotnetperls.com/Content/Unsafe-Parse.aspx for how it was made faster.

Update June 12 2008

I made the algorithm over twice as fast, so it takes 0.4 milliseconds to find all the anagrams of a common 6 letter word. It also uses 20% less RAM (2 MB less). Also it sorts all the results first by longest to shortest, and then alphabetically (a double sort). Download EXE and source now.

Anagram Free Finder

This is the source code and application for an anagram finding program in C#. It will instantly find all words contained in your string of letters and display them from longest to shortest.

Requirements

Anagram Free Finder runs on .NET 3.5 and requires that framework. The source is built with Visual Studio 2008 SP1 beta.

Screenshot

This is a picture of Anagram Free Finder. It shows that you can type into the textbox and the anagrams will instantly display on the top part.
anagram2.png
anagram1.png

Usage

Each letter you type in the bottom textbox will update the screen with all the anagram words. This occurs instantly and there is no waiting.

Implementation

The anagram finder uses a sophisticated directed acyclic word graph structure to store the words. It stores about 160,000 words. The download is about 500 KB.

Comparison

Many anagram finders are slow or show lots of ads or even have malware in them. This is open-source code and it is written in entirely managed C#. There is no native code here.

Windows Forms

The program uses Windows Forms so it looks like a standard program. It won't make you cringe every time you look at it because it is ugly.

Startup

Starting up the program is nearly instant assuming the .NET framework is loaded. The program reads about 1 MB of data when it starts up and puts it in two arrays.

1985 Technology

The data structure in this program was developed in 1985 and is called a directed acyclic word graph. This structure enables words to share prefixes and suffixes in the tree. It uses about 60% less memory than a regular tree.

Lines of Code

This program has about 400 lines of code that are commented. It was written in about 4 hours, and builds on existing technology such as the DAWG that I developed previously.

Conclusion

This anagram finder is better than most of them on the Internet, either on web pages or as downloads. It is open-source and therefore doesn't contain any bad things. It is a 400 line C# program that uses complicated technology to process anagrams extremely fast and use little memory.

About

This program is described in a more detailed way in my new article http://dotnetperls.com/Content/Anagram-Windows.aspx Anagram Open Source. Sam Allen developed this program and wrote 100% of the code. He offers more information at his website http://dotnetperls.com/ and will be providing updates and more in the future.
Last edited Oct 23 2008 at 6:08 AM  by smallenucd, version 13
Updating...
Page view tracker