C S 314 Midterm: Spring_2014_m2_GradingCrit_And_Solutions

31 views6 pages
31 Jan 2019
School
Course
Professor

Document Summary

Cs314 spring 2014 midterm 2 solution and grading criteria. Aiobe - array index out of bounds exception may occur. Not certain code works, but, can"t prove otherwise. Gacky or gack - code very hard to understand even though it works. (solution is not elegant. ) Did not answer the question asked or showed fundamental misunderstanding. Violated restrictions or made incorrect assumption: answer as shown or -1 unless question allows partial credit. No points off for minor differences in spacing, capitalization, commas, and braces or missing o( ) 10,000,000 < 20,000,000 using 500,000 instead of 1,000,000 on left side (not sorting) ok: syntax error (can"t instantiate interface) or compile error, xqmgvahqk, gmqvaxhkq, gmavqkqhx, 14 [5, -1, 4, 6, comments. We essentially did this in class when we covered stacks. St = somevariable; // does not restore stack. Suggested solution: public static > void remove(stack st, E val = st. pop(); if(val. compareto(cutoff) >= 0) temp. push(val); while(!temp. isempty()) st. push(temp. pop());