C? Bah!, that's making it too easy. Write algorithms in MIX, the way God and Knuth intended it!
in reply to Re: Perl Internals: Hashes
in thread Perl Internals: Hashes
More seriously, perl is an excellent language for learning algorithms. One can get to the crux of the algorithm without fussing with memory management and other low-level irritations. The resulting simpler, cleaner code allows one to see what is going on. And the elimination of a separate compile step allows one to play with code in a more exploratory, interactive fashion. The book
Mastering Algorithms with Perl is a fine example of how fun and easy learning algorithms can be.
I also think that having a hash as a fundamental part of the language makes a big difference in the ease of designing and implementing algorithms. Set operations become simple, as do tree and graph algorithms. There was an interesting study by Lutz Prechelt comparing programming efficiency across a wide range of languages. In it there was a text-processing task that was a natural for hashes. Despite both languages having hashes available through libraries, the C++ and Java folks tended to instead write huge amounts of code implementing n-ary trees, etc. instead of taking the easy way. Unless speed or memory limitations prevent it, it is generally a good idea to use the high-level tools you you have at hand.