Fall02M2SolutionAndCriteria

# Fall02M2SolutionAndCriteria - #1 A. B. C. D. E. F. G. H. I....

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

Sheet1 Page 1 #1 A.O(N^3) or N^3 B.O(NlogN) or NlogN base //base 2 included okay C.O(N^2) or N^2 D.O(1) or 1 or constant ot constant time E.O(N) or N, N = number of items in list F.O(N) or N, N = number of items in list G.0 1 3 7 15 H.27 I.O(2^N) or 2^N J.runtime error or error or syntax error or 13 or unknown or Exception K.O(logN) or logN // base 2 included okay L.5000 M.128 seconds or 128 //2 * 4000 ^ 3 / 1000 ^ 3 okay N.anything between 14 and 15 inclusive O.23 17 4581 96 79 52 48 70 94 74 67 order among sublists irrelevant o #2 Model Solution Object data = myHead.getData() myHead = myHead.getNext() if(iMySize == 1) myTail = null iMySize-- return data #3 Model Solution if( (toIndex - fromIndex) > 0 ) {int destIndex = fromIndex int sourceIndex = toIndex // shift items for( myCon[destIndex = myCon[sourceIndex] m

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

View Full Document
Sheet1 Page 2 // null out new empty elements for( myCon[destIndex = null] m iMySize = iMySize - (toIndex - fromIndex) } # 4 Model Solution Random rand = new Random() Object temp
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

Fall02M2SolutionAndCriteria - #1 A. B. C. D. E. F. G. H. I....

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

View Full Document
Ask a homework question - tutors are online