This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: c) Show the sequence of list values examined by binary search as it unsuccessfully searches for 100 in this list. (4 points) 78 85 86 99 1 point for each number d) Show the sequence of list values examined by binary search as it successfully searches for 1 in this list. (4 points) 78 15 1 1 point for each number plus a bonus (for any answer) 2. Consider algorithm performance. a) Suppose that you have two different algorithms to solve the same problem. The first of these algorithms is known to be O(n 2 ), the second O(n log n) for an input of size n. Which of these algorithms would you use? (2 points) O (n log n) 2 points b) What will be the approximate performance of the algorithms in part a if they are applied to 10,000 items? (2 points) O(n 2 ) = 10,000 * 10,000 = 100,000,000 1 point O(n log n) = 14 * 10.000 = 140,000 1 point...
View
Full Document
 Spring '08
 HARDWICK
 Computer Science, Binary Search

Click to edit the document details