Wikipedia, unlike most traditional Encylopedias, contains detailed descriptions of many algorithms, often with sample implementations.
This is draft of hints for good sample implementations of algorithms for Wikipedia. Further discussion is invited.
The main purpose of sample implementations is to help the reader understand the algorithm, not to provide ready-to-use code. Implementations should be easy to read and understand for average programmers or computer science students.
Programming languages that many people use or understand should be used. Suggested languages are C (especially where lower-level features are needed) Java or C++ (especially when demonstrating object-oriented algorithms or patterns), Perl, and Python. Languages with a small user base like Smalltalk or Eiffel are discouraged.
There is some controversy about sample implementations in Ruby and pseudocode. Ruby has an advantage of being very readable and a disadvantage of not being very popular. Some people prefer pseudocode, because algorithm in pseudocode isn't obfuscated by implementation details. This is major advantage as compared to some languages (like C), but is very small as compared to others (like Python and Ruby). Other arguments against pseudocode are that it's not standardized and is hard to test.
Dialects of Pascal and BASIC can have considerable incompatibilies, so if those languages are used, care should be taken to use only their most universal features. It's good to avoid language-specific constructs in examples. For example, Perl code should avoid the use of that language's more unique and unusual features that programmers of other languages will find confusing.
Using iteration is usually prefered over using tail recursion because this is more popular way of coding and because popular implementations of some languages do not support constant-space tail recursion.
In case when these hints aren't sufficient to make decisions, it's okay to provide more than one sample implementation.
A list of algorithms is available.