Questions for Discrete Structures - Homework 6 - Fall 2005 | CS 173, Assignments of Discrete Structures and Graph Theory

Material Type: Assignment; Class: Discrete Structures; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Fall 2005;

Typology: Assignments

Pre 2010

Uploaded on 03/16/2009

koofers-user-1rf
koofers-user-1rf 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS173: Discrete Mathematical Structures
Fall 2005
Homework #6
Due 10/14/05
1. Give a recursive definition of the sequence
!
{an},n=1,2,3,K
if
a.
!
an=4n"2
.
b.
!
an=1+("1)n
.
c.
!
an=n(n+1)
.
2. 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+2,b+3) "S
and
!
(a+3,b+2) "S
a. List the elements of S produced by the first five applications of the
recursive definition (including the basis step).
b. Use induction to show that
!
5a+b
when
!
(a,b)"S
. (That is, the
remainder is zero when
is divided by 5.)
3. Suppose you have a function that accepts a music genre as input, and gives some
song from that genre as output, f: Genres
Songs. Denote dance music (a music
genre) by D, and rock (another music genre) by R. A playlist is just a list of
songs. For example, f(D)f(D) is a playlist of two dance songs. Give an inductive
definition of a good playlist, P, which is defined to be a playlist with more dance
songs than rock songs. (You should assume that no song belongs to more than one
genre.)
4. a. Devise a recursive algorithm to find the nth term of the sequence defined by
!
a0=1
,
!
a1=2
,
!
a2=3
, and
!
an=an"1+an"2+an"3
, for
!
n=3,4,5K
.
b. Devise an iterative algorithm to find the nth term of the sequence defined in
part a.
c. Is the algorithm from part a or the algorithm from part b more efficient?
Explain.

Partial preview of the text

Download Questions for Discrete Structures - Homework 6 - Fall 2005 | CS 173 and more Assignments Discrete Structures and Graph Theory in PDF only on Docsity!

CS173: Discrete Mathematical Structures Fall 2005

Homework #6 Due 10/14/

  1. Give a recursive definition of the sequence !

a.^ { an^ }, n^ =^1 ,^2 ,^3 ,Kif !

an = 4 n " 2. b. !

an = 1 + (" 1 ) n. c. !

an = n ( n + 1 ).

  1. 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 + 2 , b + 3 ) " S and !

( a + 3 , b + 2 ) " S a. List the elements of recursive definition (including the basis step). S produced by the first five applications of the b. Use induction to show that !

5 a + b when !

remainder is zero when^ ( a , b )^ "^ S. (That is, the !

a + b is divided by 5.)

  1. Suppose you have a function that ac song from that genre as output, f: Genres cepts a music genre as input, and gives some  Songs. Denote dance music (a music genre) by songs. For example, D , and rock (another music genre) by f(D)f(D) is a playlist of two R dance songs. Give an inductive. A playlist is just a list of definition of a songs than rock songs. (You should assume that no song belongs to more than one good playlist, P , which is defined to be a playlist with more dance genre.)
  2. a. Devise a recursive algorithm to find the n th term of the sequence defined by

!

a 0 = 1 , !

(^) a 1 = 2 , !

(^) a 2 = 3 , and !

(^) an = an " 1 + an " 2 + an " 3 , for !

(^) n = 3 ,4, 5 K. b. Devise an iterative algorithm to find the part a. n th term of the sequence defined in c. Explain. Is the algorithm from part a or the algorithm from part b more efficient?