{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Fa08m2Crit

# Fa08m2Crit - CS307 Fall 2008 Midterm 2 suggested solutions...

This preview shows pages 1–3. Sign up to view the full content.

CS307 Fall 2008, Midterm 2 suggested solutions and grading criteria Grading acronyms OBOE - Off by one error. Calculation is off by one. AIOBE - Array Index out of Bounds Exception will occur NPE - Null Pointer Exception will occurs ABA - Answer by Accident GCE - Gross Conceptual Error. Did not answer the question asked or showed fundamental misunderstanding NAP - No answer provided. No answer given on test ECF - Error carried forward. BOD - Benefit of the Doubt. Not certain code works, but, can't prove otherwise Gacky or Gack - Code very hard to understand even though it works or solution is not elegant. (Generally no points off for this.) 1. 1. Answer as written or -1. Ignore differences in capitalization. On Big O, it is okay if missing O(). On Big O if extra term or coefficient (other than base on log) -2. A. O(N) B. O(N^2) C. O(logN) // base 3 okay D. O(NlogN) // base 2 okay E. O(N) F. O(1) G. O(N^3) // recall get from LinkedList is O(N) H. 4N^2 + 4N + 5 // + or - one on all coefficients. So for example 3N^2 + 5N + 4 is okay. I. 10,000 // all of them! J. 16 seconds K..021 seconds // as long as no logs left, other expressions okay if equal to .021 L. insertion sort // clearly O(N), insertion sort was the only sort we looked at in class that was naturally O(N) on pre sorted data. M. 10 N. deeppppp O. BABB // differences in capitalization okay

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2. Meant to be an easy question because it was only necessary to traverse the linked list. Majority of points were for correctly traversing the linked list. The majority of students did well on the question although some did make it a lot harder than it needed to be. For example, the suggested solution handles an empty list without a special case, where as a lot of students thought this would be a special case. Suggested Solution: public int numPresent(Object value){ int count = 0; Node temp = head; while(temp != null){ if( value.equals( temp.getData() ) ) count++; temp = temp.getNext(); } return count; } Grading Criteria: correctly create temp Node: 1 point
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 7

Fa08m2Crit - CS307 Fall 2008 Midterm 2 suggested solutions...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online