0% found this document useful (0 votes)
16 views

Tutorial 6

This document summarizes key topics in discrete structures for computer science including: 1) Recursively defined functions and sets 2) Structural induction 3) Recursive and iterative algorithms 4) Proving the correctness of recursive algorithms Some examples covered include recursively defining the sum of integers, proving properties of Fibonacci numbers, proving properties of maximums/minimums, and developing recursive and iterative algorithms to compute sequence terms and reverse strings.

Uploaded by

Nishit Roshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Tutorial 6

This document summarizes key topics in discrete structures for computer science including: 1) Recursively defined functions and sets 2) Structural induction 3) Recursive and iterative algorithms 4) Proving the correctness of recursive algorithms Some examples covered include recursively defining the sum of integers, proving properties of Fibonacci numbers, proving properties of maximums/minimums, and developing recursive and iterative algorithms to compute sequence terms and reverse strings.

Uploaded by

Nishit Roshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Discrete Structures for Computer Science

Tutorial 6 (Recursively defined functions and sets, structural induction,


Recursive Algorithms, Correctness of Recursive Algorithms, Recursion vs
Iteration)

1. Solve the recurrence relation and initial condition, an = an−1 + 3 for n = 1, 2, 3, . . ., and a1 =
2

2. Let F be the function such that F(n) is the sum of the first n positive integers. Give a recursive
definition of F(n).

3. Show that f0f1 + f1f2+ …+ f2n-1f2n = f2n2 a result of Fibonacci series when n is a positive
integer.

4. Let a1, a2, . . ., an, and b1, b2, . . ., bn be real numbers. Prove that max(−a1,−a2, . . . ,−an) =
−min(a1, a2, . . . , an)

5. Let S be the subset of the set of ordered pairs of integers defined recursively by
Basis step: (0, 0) ∈ S.
Recursive step: If (a, b) ∈ S, then (a, b + 1) ∈ S, (a + 1, b + 1) ∈ S, and (a + 2, b + 1) ∈ S.
a) List the elements of S produced by the first four applications of the recursive definition.
b) Use strong induction on the number of applications of the recursive step of the definition to
show that a ≤ 2b whenever (a, b) ∈ S.
c) Use structural induction to show that a ≤ 2b whenever (a, b) ∈ S.

6. Give a recursive algorithm for finding the reversal of a bit string.

7. Prove that the recursive algorithm for finding the reversal of a bit string is correct.

8. Use structural induction to prove that (w1w2)R = W2RW1R

9. Devise a recursive algorithm to find the nth term of the sequence defined by a0 = 1, a1 = 2,
and an = an−1 · an−2, for n = 2, 3, 4, . . . .

10. Devise an iterative algorithm to find the nth term of the sequence defined in question 9.

11. Is the recursive or the iterative algorithm for finding the sequence in question 9 more
efficient?

You might also like