Fa06FinalSolnAndCriteria

Fa06FinalSolnAndCriteria - CS307 Fall 2006 final Exam...

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

View Full Document Right Arrow Icon
CS307 Fall 2006 final Exam suggested solutions and grading criteria. 1. Answer as written or -2. On Big O questions leaving off O() okay. On output questions differences in spacing okay. O A. 19 / \ 12 21 / \ -5 14 B. SITRKNE B C. ITSNKRE C D. TINKERS D E. No F. 19 4 13 10 7 16 G. O(1) H. O(N) I. 100 J. O(log N) K. O(N) L. O(N) L M. It is better to sort and then do a binary search. M If the data is not sorted the number of operations is roughly 1.25 x 10^5 * 5 x 10 ^ 5. (Assumes each linear search goes about half way through the list of items.) This equals 6.25 x 10^10 ops. t If the data is sorted using quicksort, and NlogN sort, and then searched using binary search the number of ops is roughly b 1 x 10^6 * log 1 x 10^6 + 1.25 x 10^5 * log 1 x 10^ 6 = 1 x 10^6 * 2 x 10^1 + 1.25 x 10^5 * 2 x 10^1 = 2 x 10^7 + 2.5 x 10^6 = 2 x 10^7 + .25 x 10^7 = 2.25 x 10^7 2 2.25 x 10^7 is much less than 6.25 x 10^10. Or words and calculations to that effect. (No partial credit.) O N. n1 n3 n2 ----- ----- ----- | | | | | | --|-- --|-- --|-- | | | | | | | | | V V V -------------------- -------------------- | | | | | | | | | | / | ---------->| | / | / | | | | | | | | | | | ----|--------------- ----|--------------- | ^ | ^ | | | | ------- -------
Background image of page 1

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

View Full DocumentRight Arrow Icon
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

Fa06FinalSolnAndCriteria - CS307 Fall 2006 final Exam...

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