Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
ams301hw10

ams301hw10

Ratings: (0)|Views: 488|Likes:
Published by Chao Xu

More info:

Published by: Chao Xu on Apr 29, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

05/14/2010

pdf

text

original

 
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

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->