| COS 226 Code Citation Standard |
If you copy or adapt code from the course material (booksite, textbook, lecture slides, lecture videos, precept notes, etc.)†, include a citation inside your code as follows:
/* */).@citation” followed by one of the following:
Copied from:” for code that is verbatim copied from the course material.Adapted from:” for code that is based on code from the course material./* @citation Copied from: Robert Sedgewick and Kevin Wayne. * Computer Science: An Interdisciplinary Approach. * Addison-Wesley Professional, 2016, pp. 194. */
/* @citation Adapted from: https://algs4.cs.princeton.edu/11model/BinarySearch.java. * Accessed 10/30/2019. */
public class Test {
/* @citation Adapted from: Robert Sedgewick and Kevin Wayne.
* Computer Science: An Interdisciplinary Approach.
* Addison-Wesley Professional, 2016, pp. 194.
*/
// ... instance variables and methods
}
public int BinarySearch(int[] a, int k) {
/* @citation Adapted from: https://algs4.cs.princeton.edu/11model/BinarySearch.java
* Accessed 10/30/2019.
*/
// ... method implementation
}
/* @end-citation */. For example:
/* @citation Copied from: https://algs4.cs.princeton.edu/11model/Knuth.java.
* Accessed 10/30/2019.
*/
int n = a.length;
// Shuffle a[] using Knuth's shuffle
for (int i = 0; i < n; i++) {
int r = (int) (Math.random() * (i + 1));
Object swap = a[r];
a[r] = a[i];
a[i] = swap;
}
/* @end-citation */
† The citation rules apply even if the code is copied or adapted from outside the course material. Copying or adapting code that is not from the course material is a violation of course policy. Not properly citing it is plagiarism.