sp03Midterm2Soln - Spring 2003 M2 Model Solution 1. A. 80...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 Spring 2003 M2 Model Solution A. 80 sec B. 960 sec (64 * 15) sec okay C. Yes, if the Big O were quadratic (O(N^2)) execution time would increase by a factor of 4 when doubling the size of the data D. O(1) E. O(N) F. O(N^2) G. O(N^3) H. O(N^2 * log N) I. abretc J. 86 K. 3 2 19 5 23 16 101 97 42 17 155 105 43 88 L. O(N) M. O(N* log N) if sort is quicksort O(N^1.3) if shellsort used (1.2 - 1.3 okay) O(N^2) if selection, bubble, or insertion sort used N. The comparable interface allows classes to inherit one class and still inherit Comparable. Objects of a given class can now b O. One implementation of a data structure can be used to hold or store all data types. Java achieves this through inheritance a public void reverse(List a) {Object temp int lastElement = a,getSize() - 1 for(int i = 0 {temp = a.get(i) a.set(i, a.get(lastElement - i) a.set(lastElement - i, temp) } } public Set union(Set otherSet) {Set result = new Set() result.mycon = new Object[iMySize + otherSet.iMySize]
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 at Austin.

Page1 / 6

sp03Midterm2Soln - Spring 2003 M2 Model Solution 1. A. 80...

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