

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Quiz 1 CSE 21 Spring 2010 Calculate the first 6 terms for the sum of the first n odd natural numbers (n = 1, n = 2, n = 3, ... , n = 6). Then to the right calculate the sequence of differences between these terms. n Sequences of differences 1 _______________________ = _____
2 _______________________ = _____ _____
3 _______________________ = _____ _____
4 _______________________ = _____ _____
5 _______________________ = _____ _____
6 _______________________ = _____
Write the recurrence relation for the sum of the first n odd natural numbers S(n).
___________________________ if n ________ S(n) = ___________________________ if n ________
What does the sequence of differences (above) suggest for the closed-form solution to the recurrence relation?
What is a good guess for the closed-form solution to the recurrence relation above?
f(n) = ____________
Verify this with a proof by induction. Prove S(n) = f(n) for all n ___________.
Proof (Induction on n):
_________________ : If n = ______, the recurrence relation says S(__) = ____,
and the closed-form solution says f() = ____ = ____, so S() = f(__).
Inductive Hypothesis : Suppose as inductive hypothesis that S(k-1) = ________ for some k > ___.
_________________ : Using the recurrence relation, S(k) = ___________________________, by 2nd^ part of RR
= ___________________________, by IHOP
= ___________________________
= ___________________________
So, by induction, S(n) = ______ for all n >= 1 (as ______________).
What are the four general decompositions of recursive algorithms discussed in class?
Every year, Alice gets a raise of $2,500 plus 4% of her previous year's salary. Her starting salary is $35,000. Give a recurrence relation for S(n), Alice's salary after n years, for all n >= 0.
___________________________ if n ________ S(n) = ___________________________ if n ________
List three things Alan Turing is famous for: