Docsity

CS 1050 Practice Quiz: Set Ops, Math Induction, & Big O, Quizzes of Computer Science

Toggle sidebar
bg1
Practice Quiz 2
CS 1050
1. Find the value of
2. Prove that if A, B, and C are sets, then A (B B C) = (B A B) C.
Proof:
One way to do this is by a membership table. There are other ways.
A B C A B B C A (B B C)) (B A B)
C
1 1 1 1 1 1 1
1 1 0 1 0 0 0
1 0 1 0 0 0 0
1 0 0 0 0 0 0
0 1 1 0 1 0 0
0 1 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 0 0 0 0
Since the last two columns are identical, A (B B C) = (B A B) C.
3. Use mathematical induction to prove that 1+2n 3n for all n 1.
Basis Step: Let n = 1, then 1+ 21 = 3 and 31 = 3. 3 3 is true. (5 points)
Inductive Step:
Assume that 1+2n 3n . We must show that this implies that 1+2n+1 3n+1
1+2n+1 = 1 + 2*2n
< 2 + 2*2n (B since 2>1)
= 2(B 1+2n)
2(B 3n) by the induction hypothesis
3(B 3n)
= 3n+1
1
j0
i


 


i1
5
(i1) 2345620
i1
5
pf3

Partial preview of the text

Download CS 1050 Practice Quiz: Set Ops, Math Induction, & Big O and more Quizzes Computer Science in PDF only on Docsity!

Practice Quiz 2

CS 1050

**1. Find the value of

  1. Prove that if A, B, and C are sets, then A**  (B BC) = (B AB)C. Proof: One way to do this is by a membership table. There are other ways. A B C A  B B  C A(B BC)) (B AB)C 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 Since the last two columns are identical, A  (B B  C) = (B A  B)  C. 3. Use mathematical induction to prove that 1+2n^  3 n^ for all n1. Basis Step: Let n = 1, then 1+ 2^1 = 3 and 3^1 = 3. 3  3 is true. (5 points) Inductive Step: Assume that 1+2n^  3 n^. We must show that this implies that 1+2n+1^  3 n+ 1+2n+1^ = 1 + 22n < 2 + 22n^ (B since 2>1) = 2(B 1+2n)  2(B 3n) by the induction hypothesis  3(B 3n) = 3n+

j 0 i

i 1 5

 (i  1 )  2  3  4  5  6  20 i 1 5

4. Let k be a positive integer. Show that 1k+2k+…+nk^ is O(B nk+1). 1 k  2 k ...  n k  (n  1 ) k  (n  1 ) k ...  (n  1 ) k  n k (n  1 ) k 1  n k (n  1 )(n  1 ) k  n k

< (n - 1)(n)k^ + n k

= n k+

To show that the sum is O(B nk+1), we must find constant C such that |1k+2k+…+nk^ |  C|nk+1| when k > 0. From the above it is clear that this is so when C = 1.

5. Find a closed form solution for

i

i  1

i 1 

n . 1 1 1 1 1 1 1 1 1 1 1 ... 3 1 2 1 2 1 1 1 1 1 1 1             ^         ^                       ^   n n n n n n n i i n i Note that this solution uses a telescoping sum.

6. Use mathematical induction to prove that

i

i  1

i n^ 

2 n  ^

n  1

n( 2 n  1 )

for all positive integers n. Basis Case First we show that the closed form solution works for the smallest positive integer, 1. 1 i

i  1

i 1  2

 ^

Inductive Case: Assume that

i

i  1

i n^ 

2 n  ^

n  1

n( 2 n  1 )

We must show that

i

i  1

in 1 2 (n  1 )  ^

(n  1 )  1

(n  1 )( 2 (n  1 )  1 )

n  2

(n  1 )( 2 n  3 )