• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
AMS 301 Spring 2010 HW #10
Chao Xu(106978083)
7.1.6
(a) If the last digit is 1, then we have the 2nd to last digit is 0. if the last digit is 0, we have the 2nd to lastdigit is anything. Thus the recurrence relation
a
n
=
a
n
1
+
a
n
2
, where
a
0
= 1
,a
1
= 2(b) If the last digit is 1, then we have the 2nd to last digit is 0 or 2. if the last digit is not 1, we have the2nd to last digit is anything. Thus the recurrence relation
a
n
= 2
a
n
1
+ 2
a
n
2
, where
a
0
= 1
,a
1
= 3.
7.1.18
If the string of length
n
start in
or
B
, the string after it have to be a string of length
n
1 with the sameproperty. If the string of length
n
start with
A
, it must start with
AB
, the string after it has to be a stringof length
n
2 with the property. Therefore we have the relation
a
n
= 2
a
n
1
+
a
n
2
.
a
0
= 1,
a
1
= 3.
7.1.20
(
G,g,r
is green, gold, red respectively)(a).
n
feet is made of arrangment of 
n
1 feet flags end with
r
,
g
, or
n
2 feet flags end with
G
.
a
n
=2
a
n
1
+
a
n
2
,
a
0
= 1,
a
1
= 1(b).
a
n
is the amount of string meet that condition. if the string start with
G
, then we need
a
n
2
strings tofill the rest. if the string start with
rG
or
gG
,we need
a
n
3
strings to fill the rest. if the string start with
rrG,rgG,grG
or
ggG
, we need
a
n
4
strings to fill the rest. Thus we have
a
n
=
a
n
2
+ 2
a
n
3
+ 4
a
n
4
,where
a
0
= 1
,a
1
= 2
,a
2
= 5
,a
3
= 4(c). Let
a
n
be the string of length
n
with the condition. The possible starting strings are
r
or
g
with
a
n
1
strings fill the rest.The possible starting strings are
G
with
a
n
2
strings fill the rest.Remove strings start with
Grg
with
a
n
4
strings fill the rest.
a
n
= 2
a
n
1
+
a
n
2
a
n
4
where
a
0
= 1
,a
1
= 2
,a
2
= 5
,a
3
= 12
Problem A
(a).
a
n
= 5
a
n
1
+
a
n
1
= 6
a
n
1
,
a
1
= 3.(b).
a
n
= 6
a
n
1
2
n
2
,
a
1
= 3
7.2.8
(a) Divde the numbers into 2 parts, and run find the largest and 2nd largest on both recursively. It returns4 numbers, and 3 number of comparison is enough to find the largest and 2nd largest of these 4 numbers.(b)
a
n
= 2
a
n/
2
+ 2(c)
a
n
=
32
n
2, as for
a
2
only one comparison is required.1
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...