

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The fall 2003 examination 2 for the cmsc 203 course, focusing on mathematical induction, recursion, and algorithms. It includes multiple-choice questions, recursion problems, sequence calculations, big-oh analysis, and euclidean algorithm applications.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Fall 2003 Examination 2 CMSC 203
1. Circle T if the corresponding statement is True or F if it is False. T F Starting from 1, the sum of the first 200 integers is 10,100. T F The First (Weak) and Second (Strong) Principles of Mathematical Induction can be used interchangably. T F Algorithms of constant order take the same amount of time to execute, regardless of the inputs. T F Any two distinct prime numbers have 1 for a Greatest Common Divisor.
T F Functions that are O( x^1000 ) grow faster than functions that are O(2 x ). T F For all integers a, b, and c, if a divides ( b + c ), then a divides b and a divides c. T F The product of an Irrational and an Irrational is Irrational. T F For positive integers, n , GCD( n , 0) = n.
3. Let { an } and { bn } be the sequences defined, for n > 0, by: an = 3 n , bn = 2 n.
4. (a) Find the Big-Oh of the algorithm with complexity:
( n^5 + 1)( n + n^2 ) + (5 n^2 + 3 n + 2)( n^5 ).
(b) The following algorithms evaluate the polynomial anx n^ + an โ 1 xn^ โ^1 +...+ a 1 x + a 0 at x = c.
Step through each to evaluate x^3 + x^2 + x + 1 at x = 2.
procedure poly1 ( c , a 0 , a 1 , ..., an : real numbers)
power := 1 y := a 0
for i = 1 to n begin power := power * c y := y + ai * power
end output y
procedure poly2 ( c , a 0 , a 1 , ..., an : real numbers)
y := an
for i = 1 to n begin y := y * c + an โ i
end output y
5. Use the Euclidean Algorithm to find GCD(1000,256).
Docsity.com
6. Prove one of the two Theorems below using Mathematical Induction.
Theorem 1: For all integers n > 0,
Theorem 2: If an = an -1 + an -2 + an -3 and a 0 = 3, a 1 = 6, and a 2 = 9, then an < 3 n^ for all n > 2.
7. Given the sequence { ai } where an +1 = (5 an + 3) mod 7, calculate the next ten terms
when a 0 = 11. What do you observe about the sequence?
8. Prove one of the two Theorems.
Theorem 1: If every integer is divisable by a prime, then the set of primes is infinite.
Theorem 2: If n is prime, then the square root of n is irrational.
(Hint: Use the Lemma that any prime that divides p^2 also divides p )
i i ( + 1 ) ( i + 2 ) i = 1
n
n n ( + 1 ) ( n + 2 ) ( n + 3 ) 4