Docsity

Linear Search Algorithms - Discrete Structures - Exam, Exams of Discrete Structures and Graph Theory

Toggle sidebar
bg1
Exam 2 Spring 2005 CMSC 203 Discrete Structures
1.Circle T if the corresponding statement is True or F if it is False.
TFThe sequence {1, 4, 5, 9, 14, 23, 37,...} satisfies the Fibonacci relation.
TFThe First (Weak) and Second (Strong) Principles of Mathematical Induction are
logically equivalent.
TFA recursive algorithm is one which refers to itself.
TF2 + 4 + 6 + 8 + ... + 200 = 10010.
TFFunctions that are O(x10) grow faster than functions that are O(2x ).
TF
TFIn general, Linear Search algorithms are faster than Binary Search algorithms.
TFThe Euclidean Algorithm can be expressed as both an interative and a recursive
algorithm.
2. Let {an} and {bn} be the sequences defined, for n > 0, by:
an = n2 + 2, and bn = (āˆ’1)(n+1). Find c0, c1, c2, and c3 when cn = (an)(bn).
3. Trace the Division Algorithm to find (37 DIV 12) and (37 MOD 12).
4. (a) Rank from 1 (least complex) to 10 (most complex) the complexity of algorithms
with the following orders:
Order n2nlognn! 2
n1nn
nlogn10nn10
Rank
(b) Find the Big-Oh of the algorithm with complexity: (n7 + 1)(3n + n3) + (4n2 + 2n3 + 6)(n6).
5. Use the Euclidean Algorithm to find GCD(1060,160).
6. Prove one of the two Theorems below using Mathematical Induction.
Theorem 1: For all integers n > 0 and a ≠ 0,1, .
Theorem 2: If a0 = 2 and a1 = 4, then an = anāˆ’1 + anāˆ’2 is divisible by 2.
7. Prove one of the two Theorems below:
Theorem 1: The difference of the squares of an integer and its predecessor is odd.
Theorem 2: If a and b are Integers with a < b, then there is a Rational, q, such that a < q < b.
8. Prove one of the two Theorems below by Contradiction.
Theorem 1: The sum of any rational number and any irrational number is irrational.
Theorem 2: For all Naturals n and primes p, if p divides n, then p does not divide (n + 1).
caibi
+()
i0=
n
āˆ‘ca
i
i0=
n
āˆ‘bi
i0=
n
āˆ‘
+=
i3
i1=
n
āˆ‘n2n1+()
2
4
-------------------------=
Docsity.com

Partial preview of the text

Download Linear Search Algorithms - Discrete Structures - Exam and more Exams Discrete Structures and Graph Theory in PDF only on Docsity!

Exam 2 Spring 2005 CMSC 203 Discrete Structures

1. Circle T if the corresponding statement is True or F if it is False. T F The sequence {1, 4, 5, 9, 14, 23, 37,...} satisfies the Fibonacci relation. T F The First (Weak) and Second (Strong) Principles of Mathematical Induction are logically equivalent. T F A recursive algorithm is one which refers to itself. T F 2 + 4 + 6 + 8 + ... + 200 = 10010.

T F Functions that are O( x^10 ) grow faster than functions that are O(2 x^ ).

T F

T F In general, Linear Search algorithms are faster than Binary Search algorithms. T F The Euclidean Algorithm can be expressed as both an interative and a recursive algorithm.

2. Let { a (^) n } and { bn } be the sequences defined, for n > 0, by:

an = n^2 + 2, and bn = (āˆ’1)( n +1). Find c 0 , c 1 , c 2 , and c 3 when c (^) n = ( an )( bn ).

3. Trace the Division Algorithm to find (37 DIV 12) and (37 MOD 12). 4. (a) Rank from 1 (least complex) to 10 (most complex) the complexity of algorithms with the following orders:

Order n

n log n n! 2

n

1 n n

n

log n 10

n

n

Rank

(b) Find the Big-Oh of the algorithm with complexity: ( n^7 + 1)(3 n + n^3 ) + (4 n^2 + 2 n^3 + 6)( n^6 ).

5. Use the Euclidean Algorithm to find GCD(1060,160). 6. Prove one of the two Theorems below using Mathematical Induction.

Theorem 1: For all integers n > 0 and a ≠ 0,1,.

Theorem 2: If a 0 = 2 and a 1 = 4, then an = an āˆ’ 1 + a (^) n āˆ’ 2 is divisible by 2.

7. Prove one of the two Theorems below: Theorem 1: The difference of the squares of an integer and its predecessor is odd. Theorem 2: If a and b are Integers with a < b , then there is a Rational, q , such that a < q < b. 8. Prove one of the two Theorems below by Contradiction. Theorem 1: The sum of any rational number and any irrational number is irrational. Theorem 2: For all Naturals n and primes p , if p divides n , then p does not divide ( n + 1).

( ca (^) i + b (^) i ) i = 0

n

āˆ‘ c^ a^ i

i = 0

n

āˆ‘ b^ i

i = 0

n

i 3

i = 1

n

n 2 ( n + 1 ) 2

4

Docsity.com