Programming Assignment FAQ |
For course policies regarding submission, lateness, grading, and collaboration, see the Assignments page.
readme.txt
file.
acknowledgments.txt
file when you are ready to have
your assignment graded.
acknowledgments.txt
file.
So, when you are read to submit the assignment, simply upload the acknowledgments.txt
file
and we will know that it is ready to be graded.
PercolationStats.java
to receive feedback on Percolation.java
,
but you must submit
Percolation.java
to receive meaningful feedback on PercolationStats.java
(because, if you don't, PercolationStats.java
won't compile).
Yes. For some assignments, you will be given very clear instructions on how to implement the test client. In others, you will be asked to implement your own test client that tests the methods you have implemented. Although the autograder tests your code, you are expected to test your code before you use the autograder.
For grading purposes, your test client will satisfy the requirements if it calls every public method in your code at least once in a meaningful way (by printing the return value, for example). For genuinely testing your code, you will often need to do more than that.
In general, professional programmers must write code to carefully check and validate any user input.
In this course, however, you may assume that user specifies valid input.
For example, you may assume that the command-line arguments to PercolationStats
are
two integers (and not, say, a string and a double).
Example 1:
This code can be written as:if (isTrue) doA(); doB(); doC(); doD(); } else { doB(); doC(); doD(); }
if (isTrue) doA(); doB(); doC(); doB();
Example 2:
This code can be written as:doA(); doB(); doC(); doD(); while (isTrue) { doA(); doB(); doC(); doD(); }
You can also declare a functiondo { doA(); doB(); doC(); doD(); } while (isTrue);
doAll()
(for e.g.) that calls doA(), doB(), doC()
and use it as follows:
doAll(); while (isTrue) doAll();
Always consider using functions to encapsulate repeated code. Avoiding repeated code using functions enhances readability, simplifies debugging and localizes future changes to a single place.
readme.txt
file.
algs4.jar
to your Java classpath.
Arrays.sort()
,
java.util.LinkedList
, java.util.ArrayList
, java.util.TreeMap
, and
java.util.HashMap
?java.lang
such as Math.sqrt()
and Integer.parseInt()
.
Queue<String>
and is implemented as a linked list of nodes, you should count the memory of the Node
objects
(including references to the String
objects)
but not the memory of the String
objects themselves.
The String
objects in the queue are allocated by the client of the queue,
whereas the Node
objects are allocated by the queue itself.