This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CIS 435 DL, Spring 2004 Midterm Exam Prof. J. Calvin Print Name (last name first): This exam consists of 7 pages, numbered 1 through 7. Before starting to work, make sure that you have all 7 pages. There are six problems, each counting 20 points. Write all answers on the exam. During this exam it is prohibited to: 1. exchange information with any other person in any way, including by talking or exchanging papers or books; 2. use any electronic aid, including calculators; 3. use any books or notes; 4. leave the exam room before you complete and turn in your exam. I have read and understand all of the instructions above. On my honor, I pledge that I have not violated the provisions of the NJIT Academic Honor Code. Signature and Date Stirlings approximation : n ! = 2 n n e n (1 + (1 /n )) . Master Theorem: The solution T ( n ) to the recursion T ( n ) = aT ( n/b )+ f ( n ) can be bounded as follows: 1. If f ( n ) = O ( n log b a- ) for some > 0, then T ( n ) = ( n log b a ) . 2. If f ( n ) = ( n log b a ) then T ( n ) = ( n log b a lg n ) . 3. If f ( n ) = ( n log b a + ) for some > 0, and if af ( n/b ) cf ( n ) for some constant c < 1 and all sufficiently large n , then T ( n ) = ( f ( n )). 1 2 1. Say whether the following statements are true or false. Give a short explanation (a sentence should do). a) The array (13 , 10 , 7 , 9 , 6 , 8) is a max-heap. It is not a max-heap, since the left child of the node with value 7 has value 8. b) Any algorithm to sort an array of n numbers has a running time that is ( n )....
View Full Document
This note was uploaded on 09/29/2010 for the course CS CS 435 taught by Professor Alex during the Spring '09 term at NJIT.
- Spring '09