{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


Spring10_M2_SuggestedSolutioAndGradingCrit - CS307 Spring...

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

View Full Document Right Arrow Icon
CS307 Spring 2010 Midterm 1 Solution and Grading Criteria. Grading acronyms: AIOBE - Array Index out of Bounds Exception may occur 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.) GCE - Gross Conceptual Error. Did not answer the question asked or showed fundamental misunderstanding LE - Logic error in code. NAP - No answer provided. No answer given on test NN - Not necessary. Code is unneeded. Generally no points off NPE - Null Pointer Exception may occur OBOE - Off by one error. Calculation is off by one. 1.A You should comment all your code and programs, even the ones you only intend for your own use. The reason to do this is 6 months after you write a program you will forget how it works or what you were trying to do and it is more time consuming to change or update. (Because you have to figure out what the heck you code dies.) OR words to that affect. Partial credit possible B. Making a project open source is selfish because programmers will work on it and you don't have to pay them. You can incorporate their good changes into the project for free. Allen also related that when they went open source a lot more bugs in the code were found and reported so they could be fixed. OR word to that affect. Partial credit possible C. 12 D. laeyyy E. 39 F. O(N) G. O(N^2) H. O(N^2) I. O(NlogN) // base 2 okay J. O(N^2) K. O(N^2) L. 63 seconds M. 840 / 19 seconds OR 10 * 4 * 21 / 19 seconds OR 40 * 21 / 19 seconds OR a little more than 44 seconds. (40 seconds is not correct.) N. 12,500 pieces of data or 50,000 / 4 O. Sort the data. Without sorting the work is 50,000 * 1,000,000 / 2 (assume on average we look at half the elements. = 25,000,000,000 operations.
Background image of page 1

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

View Full Document Right Arrow Icon
Sorting will take 1,000,000 log 1,000,000 = 1,000,000 * 20 = 20,000,000 ops plus the binary searches = 50,000 * 20 = 1,000,000 = 21,000,000 ops total. 21,000,000 << 25,000,000, 1 point for the math, 1 point for correct math.) 2. Comments. This was not an easy question. There was a lot to keep track of.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}