Fa07m2Crit - CS307 Fall 2007, Midterm 2 suggested solutions...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS307 Fall 2007, 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. 7 B. stendts C. 74 D. O(N) E. O(N^2) F. O(1) G. O(N^2) // recall get from LinkedList is O(N) H. O(NlogN) // base 3 on log okay I. O(2^N) J. 345 K. false // recall size is changing as we remove things. This is a cross over logic error L. 7856 M. 1553 N. 4 seconds O. 160 seconds // selection sort is O(N^2) 2. A difficult question and there were a large variety of answers. Probably the most difficult question on the test. You had to find the last node in the list containing the target data or show it wasn't there. Walking off the end of the list shouldn't have been too hard because you had the size instance variable available. There were three main approaches. 1. The easiest approach was a 2 pass algorithm. Simply go through the whole list once and determine the index of the last occurrence. This approach did not try to maintain a pointer to the node before the last occurrence in the first pass. In the second pass iterate to the node before the one to be removed and then
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Fa07m2Crit - CS307 Fall 2007, Midterm 2 suggested solutions...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online