Algorithm Guidelines
Algorithm Guidelines
Throughout the class, you will be asked to write-up an algorithm you have
designed to solve a problem. Whether on a homework assignment, project, or an
exam, your solution is expected to contain the following sections. Each section
should be long enough to contain a full, readable explanation of your solution,
and no longer. Remember that the burden of proof is on you. If what you are
explaining isn’t clear to you, you will have no hope of convincing anyone else. On
the other hand, when presenting algorithms, more detail is not necessarily better.
The golden standard is concise but unambiguous.
You may assume that the reader is familiar with the problem. You may make
use of any standard data structures (linked lists, binary trees, heaps, etc), as well
as basic sorting and searching algorithms (linear search, binary search, insertion/s-
election/quick sort, etc) without explaining how to implement them.
1
at a high enough level so that it can be easily read and understood. Be
sure that the interpretation of your pseudocode is unambiguous and that
you include explicitly the input and output values.
Here are a few tips:
• Proof of Correctness. A proof that your algorithm does what you say it
does and is optimal (if appropriate). If this is a proof by induction, be sure
to state clearly what the base case, inductive hypothesis, and induction steps
are. If this is a proof by contradiction, state clearly what the assumption
to be contradicted is. In general, be sure to define any terms used and
construct a logical argument using complete mathematical sentences. Try
to avoid rambling about obvious or trivial elements and focus on the key
elements. A good proof provides a high-level overview of what the algorithm
does, and then focuses on any tricky elements that may not be obvious.