Algorithm Museum Coding Standards


The above is a computer program for calculating profit and loss!
  1. All code should be stored in a single file named for the chapter in CLRS for which it implements the algorithms, OR it should be in a directory with such a name, if there is more than one file for the code. So, if the C source code for chapter 4 is in a single file, it should be called divide_and_conquer.c.

    If a directory is used, the directory should be named in mixed case: DynamicProgramming.
  2. There should be a test for each algorithm implemented.
  3. Code should reflect the pseudocode in CLRS "fairly" closely. How close depends greatly on the language being used for implementation. Clearly, an implementation in Lisp or a assembly language is not going to be as close to the textbook pseudocode as one in Pascal. The decision as to whether to use a "shortcut" provided by a language should be based on how crucial the code in question is to the algorithm. Clearly, we can't "implement" quicksort just by calling the library quicksort routine! But if the pseudocode is dividing an array into pieces for a divide-and-conquer algorithm, it is fine to use Python's slicing capability.
  4. Code should print intermediate results along the way: this project is educational, and we want to help students to understand what is happening!
  5. Students should be able to generate their own input to experiment with the algorithms as easily as the language allows.

Additional Standards for Each Language