{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Final.sp10

Final.sp10 - Signature Name Student ID Final CSE 21 Spring...

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

View Full Document Right Arrow Icon
0 Signature ___________________ Name ______________________ Student ID __________________ Final CSE 21 Spring 2010 Page 1 ___________ (30 points) Page 2 ___________ (18 points) Page 3 ___________ (11 points) Page 4 ___________ (12 points) Page 5 ___________ (13 points) Page 6 ___________ (34 points) Page 7 ___________ (10 points) Page 8 ___________ (11 points) Page 9 ___________ (5 points) SubTotal ___________ (144 points = 100%) Page 10 ___________ (10 points) Extra Credit (7%) Total ___________
Background image of page 1

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

View Full Document Right Arrow Icon
1 { Calculate the first 6 terms for the triangular numbers ( n = 1, n = 2, n = 3, . .. , n = 6). Then to the right calculate the sequence of differences between these terms. 1 st triangular number is 1. n Sequences of differences 1 _______________________ = _____ _____ 2 _______________________ = _____ _____ _____ 3 _______________________ = _____ _____ _____ 4 _______________________ = _____ _____ _____ 5 _______________________ = _____ _____ _____ 6 _______________________ = _____ Write the recurrence relation for the triangular numbers T ( n ). ___________________________ if n ________ T ( n ) = ___________________________ if n ________ Based on the sequence of differences (above) what is a good guess for the closed-form solution to the recurrence relation above? f ( n ) = ____________ Why?: Verify this with a proof by induction. Prove T ( n ) = f ( n ) for all n ___________ . Proof (Induction on n ): _________________: If n = ____, the recurrence relation says T (__) = ____, and the closed-form solution says f (__) = ______ = ____, so T (__) = f (__). _________________: Suppose as inductive hypothesis that T ( k -1) = ____________________ for some k > ___. _________________: Using the recurrence relation, T ( k ) = ___________________________, by 2 nd part of RR = ___________________________, by IHOP = ___________________________ = ___________________________ So, by induction, T ( n ) = ____________ for all n >= 1 (as ______________). A) 4n – 2n B) n 3 – n C) n 4 – n 2 + 2 D) (n 2 + n)/2 E) 2n + n F) 2 n + n * * * * * * * * * * etc. n = 1 n = 2 n = 3 n = 4
Background image of page 2
2 What are the four general decompositions of recursive algorithms discussed in class? _______________________________ _______________________________ _______________________________ _______________________________ Which of the above general recursive decompositions are most appropriate for the following algorithms: Factorial ____________________________ Binary Search _______________________________ Palindrome ____________________________ Fractal graphic _______________________________ Check output (for example, Koch snowflake or tree fractal) List/String reversal ________________________ List/String reversal ____________________________ moving last element to front, recurse on rest exchanging first and last elements, recurse on rest (s a ) R a (s) R Which is true about proof by induction on k (IHOP on k and IS on k +1) vs proof by induction on k -1 (IHOP on k -1 and IS on k )? _____ A) Both the same
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 13

Final.sp10 - Signature Name Student ID Final CSE 21 Spring...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online