Sp07FinalKey - S307 - Final - Spring 2007 1. 2 points each....

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

View Full Document Right Arrow Icon
S307 - Final - Spring 2007 1. 2 points each. Big O answers with out the O() are okay. A. 25 B. EMCOTUP / \ C. CMOEUPT -5 39 D. COMPUTE \ E. No 12 F. 935141 / G. O(NlogN) 7 H. Must be able to test if an object is less than, equal to or greater than objects already in the tree. (Or words to that effect.) -1 if appropriate I. 2^16 J. No, can't accept ArrayLists unless specifically parameterize with String; ArrayList<anything other than String> is a syntax error. -1 if appropriate (Or words to that effect.) K. O(K) accept O(K-N) L. O(N) M. Instance variable for the number of elements (Or words to that effect.) N. O(logN) O. Unless the new encoding scheme is agreed upon, the key / new encoding scheme must be sent as well and for small files that is a large amount of overhead (Or words to that effect.)
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. Special cases: 1. adding to empty list. 2. adding at position 0 in none empty list. public boolean insert(Object item, int pos){ boolean added = false; // empty list or position == 0? if( pos == 0){ added = true; head = new Node(item, head) } else if(head != null) { Node temp = head; int moved = 0; //try to move to the node before the position to insert at temp = temp.getNext(); moved++: } //if able to get to correct spot, insert new node if( moved == (pos - 1) ){
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 at Austin.

Page1 / 6

Sp07FinalKey - S307 - Final - Spring 2007 1. 2 points each....

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