I copied (and failed to cite) two lines of code from the OpenJDK source for an undergraduate Data Structures project. Yet, the code comparison shows an alarming amount (40%) of similarity. Here is the side-by-side comparison with my file.

Based on these grounds, my professor wants to give me a -100% on the assignment, which would bring down my overall grade by 15% total, probably causing me to not make the C-wall (depending on how well I do on the final exam). For this reason (and my conscious), I decided to appeal.

However, I believe that most of the similarity in the report comes from my copying of lines 142-152:

static int hash(int h) {
    h ^= (h >>> 20) ^ (h >>> 12);
    return h ^ (h >>> 7) ^ (h >>> 4);

I did not cite these two lines, but I did intend to delete them later.

In fact, this whole function can be removed without affecting the program at all, which results in this file comparison.

Then, only lines 114-126 are a problem:

MyEntry<K, V>[] newArr = new MyEntry[newSize];
// Copy
for (int i = 0; i < data.length; i++) {
    MyEntry<K, V> e = data[i];
    if (e != null) {
        data[i] = null;
        do {
            MyEntry<K, V> next = e.next;
            int j = e.hash % newSize;
            e.next = newArr[j];
            newArr[j] = e;
            e = next;
        } while (e != null);

However, this snippet is my own. I wrote these lines without referencing HashMap.java, and this is a common algorithm for chaining that I can explain thoroughly, and have known about for years.

Yes, I know the fact I copied the other two lines compromises my integrity and made the 20% into 40% to begin with, so how can I prove this?

I’m not sure how to defend this whole case before a Student Conduct Board who knows very little about programming. My board hearing is in a month. Does these two snippets of code constitute plagiarism of my entire project? Is -15% to my overall grade fair?


  • Our projects are pretty extensive since we aren’t allowed to use java.util.* (like 1k+ lines for each project in 8 days), and I did not copy any other code. I’d say the actual data structure implementation is only meant to take about 1/5 our time spent per project.
  • Over 30% of the class has been reported for academic integrity violations on projects over the semester, and the newly graduated professor doesn’t seem to think himself or his assignments are the problem. I should have caught onto the warning before this last project of the semester…

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>