This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS 373 Final Exam Questions (May 7, 2001) Spring 2001 You must turn in this question sheet with your answers. 1. D´ej`a vu Prove that any positive integer can be written as the sum of distinct nonconsecutive Fibonacci numbers—if F n appears in the sum, then neither F n +1 nor F n- 1 will. For example: 42 = F 9 + F 6 , 25 = F 8 + F 4 + F 2 , and 17 = F 7 + F 4 + F 2 . You must give a complete, self-contained proof, not just a reference to the posted homework solutions. 2. L’esprit d’escalier Recall that the staircase of a set of points consists of the points with no other point both above and to the right. Describe a method to maintain the staircase as new points are added to the set. Specifically, describe and analyze a data structure that stores the staircase of a set of points, and an algorithm INSERT ( x,y ) that adds the point ( x,y ) to the set and returns TRUE or FALSE to indicate whether the staircase has changed. Your data structure should use O ( n ) space, and your INSERT algorithm should run in O (log n ) amortized time....
View Full Document
- Spring '09
- Analysis of algorithms, Computational complexity theory, NP-complete, Dominoes, longest palindrome prefix