This document describes how solutions to programming exercises are graded.
Please submit all your solutions through Moodle, except for the course project.
Each exercise will be graded as follows:
| Correctness | 60% |
| "Correct" approach | 30% |
| Comments and Organization | 10% |
This is relatively straightforward: if the solution is correct on every test input cases, you get 100% on this part. If it is not correct, then how many marks you get depend on how close you are. If you are wrong on only a few cases, then only a small number of marks will be deducted. But if your solution only works for a few cases, then you should not expect many marks.
For the purpose of correctness, solutions with "presentation errors" are considered to be "accepted".
Some problems can be solved by many approaches. There are usually one or two "correct" approaches that are "elegant", easy to implement, easy to reason about, etc. Sometimes the same problem can be solved through some other approach that is much more "messy" and therefore inferior. Sometimes the problem size is small and using the general "elegant" approach is actually worse than using a "quick-and-dirty" approach that may not scale well. Usually the topics covered in the course will give you an idea of what approach is to be expected. Note that how you choose to represent and store your data in the program is also part of the consideration here.
In cases where the solution is correct but the approach is not, partial marks will be given depending on how good this approach is. In cases where the solution is incorrect but the approach is correct, partial marks (possibly full marks) will be given depending on how much of the details in the approach are correct. If both the solution and the approach are incorrect, partial marks will be given depending on how close the approach is to the correct one(s). For example, if a solution only solves small instances but has no chance of solving the larger cases, you should not expect many marks.
Please comment and organize your code. For simple problems, just a comment on your general approach at the top of the file will do, and it is okay if everything is in one main routine.
For more complicated problems, you should not only comment on the general approach but also put in short comments to indicate the major steps. You should also organize your code into functions. Rule of thumb: if your function is longer than one screen (approx. 30 lines), it is probably too long.
There is no need to over-comment or comment each function, each variable/function parameter. Just comment the main steps in the algorithm, and any particularly tricky piece of code. Cryptic and difficult pieces of code are allowed in this course.
You may use C, C++, Java or Python for your solutions. Your solutions will be evaluated on the machines in the department's computer labs. Please ensure that they are compatible with the compilers and run-time environments on these systems.
You may use any source code provided by the instructor and the textbook (with or without modification) without citing its sources. However, you may not use source code from any other sources (e.g. forums, blogs, etc.). If you do find complete code, you may read it to understand what it does, and then write your own solution.
You may find ideas, psuedocode, or even complete code for solving the assigned exercises on the Internet, in books, etc. If you make use of these resources, please cite them in the comments of your code. Failure to do so will be considered plagiarism.
Discussing with your classmates is allowed, but you must write your own solutions.