Fa04FinalKey - CS307 Fall 2005 final exam suggested...

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

View Full Document Right Arrow Icon
CS307 Fall 2005 final exam suggested solutions and grading key 1. answer as written or -2. differences in capitalization and spacing okay. on big o missing O( ) okay, but no extra terms A. 32 / \ 5 74 / \ 4 31 B. 52 25 9 5 30 72 70 75 C. 5 9 30 25 52 70 72 75 D. 5 30 9 25 70 75 72 52 E. 52 25 72 9 70 75 5 30 F. No G. front back 3 4 5 3 H. front back 2 1 5 I. 999 (1000 okay) J. any answers 15 - 35 K. O(N) L. interfaces allow for a limited form of multiple inheritance. They also allow design without any implementation details. This allows many implementations. (or words to that effect) -1 at discretion of grader M. 4N + 7 (+/- 2) N. O(N^2 log N) O. O(N^3)
Background image of page 1

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

View Full DocumentRight Arrow Icon
2. public boolean isPresent(Comparable data) { return helper( data, myRoot ); } private boolean helper( Comparable data, RBTreeNode n) { if( n == null ) return false; else { int dir = data.compareTo( n.getData() ) { if( dir == 0 ) return n.isPresent(); else if( dir < 0 ) return helper( data, n.getLeft() ); else return helper( data, n.getRight() );
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.

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 / 3

Fa04FinalKey - CS307 Fall 2005 final exam suggested...

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

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