Algorithms in computer code

Guidelines for the algorithms that you are asked to turn into real code for class use.

  1. Generate a compilable/executable file. That means import the right modules. In Java the result should be one or more classes…

  2. For sorts you can keep things simple and assume integer data. Stay away from defining generic classes in Java unless you are looking for trouble.

  3. Test your code. Turn in simple test code in another file for Java and for Python if you like.  If you want to doctests in Python, embedded in your documentation, fine.

  4. Ideally follow the basic algorithm in the book. That takes no further explanation. If you make some improvement, make sure you explain it. Make sure if you alter the algorithm that it is an improvement. If you grab someone else's algoithm, and it includes further support classes, make sure the support classes are also included and fully explained. 

  5. Your time and memory big Oh orders should not be more than the basic book algorithm.

  6. Look back.  The idea of this activity is to clearly realize and explain the algorithm in a useful way for the rest of the class. Have you done it?