Professional Documents
Culture Documents
Assignment 7 - Discrete Structures
Assignment 7 - Discrete Structures
1 1 1 1 n
(Q1) Prove the following by induction: + + … =
2× 5 5 ×8 8 ×11 ( 3 n−1 )( 3 n+1 ) 6 n+ 4
Let T (n) be the running time of the above algorithm, when the input is n. Express T (n) as a
recursive formula in terms of T (n−1) , T (n−2) and, maybe, some integers. Also, write the
base cases. (see the videos on recursive functions).
Please note above, that the function definition of ‘weird(n)’ does not follow the syntax of any programming
language --- although it is close to Python. It was just written in a way so that you can understand what it is
Remember that the dots mean multiplication (they are typically written higher than where the decimal points are
placed, as you can see below) .
We want to calculate a non-recursive formula for T(n). Someone reasoned like follows:
We know that T(0) = 3. Hence by the recursive formula,
T ( 1 )=5 T ( 0 ) +6=5∙ 3+6
T ( 2 ) =5T ( 1 )+ 6=5 ∙ 5∙ 3+5 ∙ 6+6
T ( 3 )=5 T ( 2 ) +6=5∙ 5 ∙5 ∙ 3+5 ∙5 ∙ 6+5 ∙ 6+6
And so on ….
But note, this is a ‘guess’. One still needs to prove by induction, which is what the question
asked you to do.
(a) From the above numerical experiment, how would you get to the ‘guess’ that
6
T ( n )=3 ∙5 n+ ( 5 n−1 ). Explain in just 1 – 3 sentences.
4
(b) Prove this formula using induction. That is, the recursive formula at the top of this
n 6 n
question, can also be given by: T ( n )=3 ∙5 + ( 5 −1 )
4