Sp08m2Crit - CS307 Spring 2008 Midterm 2 Solution and...

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

View Full Document Right Arrow Icon
CS307 Spring 2008 Midterm 2 Solution and Grading Criteria. Grading acronyms: ABA - Answer by Accident AIOBE - Array Index out of Bounds Exception may occur BOD - Benefit of the Doubt. Not certain code works, but, can't prove otherwise ECF - Error carried forward. 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 NAP - No answer provided. No answer given on test NN - Not necessary. Code is unneeded. NPE - Null Pointer Exception may occur OBOE - Off by one error. Calculation is off by one. 1. 2 points per question. No partial credit. On Big O question if answer is O(N) N is acceptable. No constants or extra terms on Big O. For example if answer is O(N) then O(4N) is counter wrong as is O(N + 10). A. 9 B. 14 C. 6 D. O(N^2) E. O(N) F. O(logN) // base 3 okay G. O(N^2) H. O(N^3) I. O(N) J. O(N^2) K. DECB // decb okay, quotes okay if included L. 10 10 9 7 4 M. -2 0 2 N. 64 seconds O. 21 seconds (2 * 10 * 21 / 20) okay. (20 is NOT acceptable.) P overworked +1 point extra credit. Ignore differences in capitalization or if two words instead of 1. Commentary on short answer: A. simple recursion. B. must build the table to avoid repeated effort C. recursively determines max value in array D. No difference between best, worst, average big O case. All O(N^2) E. Loops not nested so just O(N) F. A different log N problem. G. This is the bubble sort algorithm, No difference between best, worst, average big O case. All O(N^2). (Bubble sort can be modified so it is O(N) best case if data already sorted, but this version does not do that.) H. Simple O(N^3) I. Math.max O(1) so O(N) overall. N steps J. Removing first element of an array based list is O(N) with all the shifting. So N times through while loop. Average size of list is N/2. Average of N/2 shifts per remove. N removes. So (N^2) K. Toy list code. Testing your understanding of what a list does. L. "" The fact that it is linked list doesn't change the problem. M. Toy stack code. Testing your understand of what a stack does.
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.

This note was uploaded on 11/30/2010 for the course CS 307 taught by Professor Scott during the Spring '08 term at University of Texas.

Page1 / 5

Sp08m2Crit - CS307 Spring 2008 Midterm 2 Solution and...

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