Download presentation
Presentation is loading. Please wait.
Published byArline Ball Modified over 9 years ago
1
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1
2
Recurrence Relations Konstantin Busch - LSU2 Sequence Recurrence relation: For any
3
Konstantin Busch - LSU3 Example: Solutions to recurrence relation: Recurrence relation
4
Konstantin Busch - LSU4 $10,000 bank deposit %11 interest :amount after years Example:
5
Konstantin Busch - LSU5 Fibonacci sequence Example:
6
Konstantin Busch - LSU6 Towers of HanoiExample: bar1bar2bar3 Goal: move all discs to bar3 Rule: not allowed to put larger discs on top of smaller discs discs
7
Konstantin Busch - LSU7 bar1bar2bar3 move recursively discs to bar2Step 1:
8
Konstantin Busch - LSU8 bar1bar2bar3 move largest disc to bar3Step 2:
9
Konstantin Busch - LSU9 bar1bar2bar3 move recursively discs to bar3Step 3:
10
Konstantin Busch - LSU10 :total disc moves 2 recursive calls with discs (steps 1&3) movement of largest disc (step 2) one move for one disc
11
Konstantin Busch - LSU11
12
Solving Linear Recurrence Relations Konstantin Busch - LSU12 Linear homogeneous recurrence relation of degree : Constant coefficients:
13
Konstantin Busch - LSU13 A sequence (solution) satisfying the relation is uniquely determined by the initial values: (these are different constants than the coefficients)
14
Konstantin Busch - LSU14 if an only if Solution to recurrence relation: divide both sides with characteristic equation
15
Konstantin Busch - LSU15 characteristic equation: factorize with roots characteristic roots: Multiple possible solutions:
16
Konstantin Busch - LSU16 The solutions may not satisfy the initial conditions
17
Konstantin Busch - LSU17 Theorem:Recurrence relation of degree 2 has unique solution where are solutions to the characteristic equation, and are constants that depend on initial conditions
18
Konstantin Busch - LSU18 Characteristic Equation Roots: Proof:
19
Konstantin Busch - LSU19 First compute from initial conditions
20
Konstantin Busch - LSU20
21
Konstantin Busch - LSU21 Prove by induction that Basis cases: true for the specific choices of
22
Konstantin Busch - LSU22 Inductive hypothesis: for all Inductive step: for prove that assume that
23
Konstantin Busch - LSU23 By inductive hypothesis:
24
Konstantin Busch - LSU24 By recurrence relation definition Inductive hypothesis End of Proof
25
Konstantin Busch - LSU25 Fibonacci sequence Example: Has solution: Characteristic roots:
26
Konstantin Busch - LSU26
27
Konstantin Busch - LSU27
28
Konstantin Busch - LSU28 Degree recurrence relation: has unique solution where are solutions to the characteristic equation, and are constants that depend on initial conditions
29
Konstantin Busch - LSU29 Example: Solution: Characteristic equation: Roots:
30
Konstantin Busch - LSU30 Final solution:
31
Recurrence Relations for Divide and Conquer Algorithms Konstantin Busch - LSU31 Typical divide and conquer algorithm: Input of size Divide into sub-problems each of size Combine sub-problems with cost
32
Konstantin Busch - LSU32 Divide an conquer recurrence relation: Cost of subproblem of size
33
Konstantin Busch - LSU33 Examples: Binary search: Merge Sort: Fast Matrix Multiplication (Stassen’s Alg.):
34
Konstantin Busch - LSU34 Theorem: if then
35
Konstantin Busch - LSU35 Proof:
36
Konstantin Busch - LSU36
37
Konstantin Busch - LSU37 End of Proof
38
Konstantin Busch - LSU38 Theorem: if then
39
Konstantin Busch - LSU39 Proof: From previous theorem
40
Konstantin Busch - LSU40 Case:
41
Konstantin Busch - LSU41 Case: End of Proof
42
Konstantin Busch - LSU42 Example: Binary search:
43
Konstantin Busch - LSU43 Master Theorem: if then
44
Konstantin Busch - LSU44 Example: Merge Sort:
45
Generating Functions Konstantin Busch - LSU45 Find number of solutions for: Answer:
46
Konstantin Busch - LSU46 Alternative solution choices for
47
Konstantin Busch - LSU47 Alternative solution is the total number of solutions to equation
48
Konstantin Busch - LSU48 Another problem: Find total number of solutions which satisfy:
49
Konstantin Busch - LSU49 Alternative solution choices for
50
Konstantin Busch - LSU50 Alternative solution is the total number of solutions to equation
51
Konstantin Busch - LSU51 Generating function: generating function for sequence
52
Konstantin Busch - LSU52 Solve recurrence relation Generating functions can also be used to solve recurrence relations Example:
53
Konstantin Busch - LSU53 Let be the generating function for sequence
54
Konstantin Busch - LSU54
55
Konstantin Busch - LSU55
56
Konstantin Busch - LSU56
57
Konstantin Busch - LSU57
58
Konstantin Busch - LSU58 Solution to recurrence relation
59
Inclusion-Exclusion Konstantin Busch - LSU59
60
Konstantin Busch - LSU60
61
Konstantin Busch - LSU61 Principle of Inclusion-Exclusion:
62
Konstantin Busch - LSU62 Proof: We want to prove that: an arbitrary element is counted exactly one time in the expression of the theorem
63
Konstantin Busch - LSU63 Suppose is a member of exactly sets: Then is counted in the terms:
64
is counted times Konstantin Busch - LSU64 In sum: (since belongs exactly to sets)
65
is counted times Konstantin Busch - LSU65 In sum: (since belongs exactly to sets)
66
is counted times Konstantin Busch - LSU66 In sum: (since belongs exactly to sets)
67
is counted times Konstantin Busch - LSU67 In sum: (since belongs exactly to sets)
68
Konstantin Busch - LSU68 Thus, in the expression of the theorem is counted so many times:
69
Konstantin Busch - LSU69 End of Proof From binomial expansion we have that: Thus, is counted exactly one time
70
Konstantin Busch - LSU70 Example:Find the number of primes between 1…100 If a number is composite and between 1…100 then it must be divided by a prime which is at most : 2, 3, 5, 7
71
Konstantin Busch - LSU71 :the set of primes between 1…100 :composites between 1…100 divided by 2 :composites between 1…100 divided by 3 :the set of composites between 1…100 :composites between 1…100 divided by 5 :composites between 1…100 divided by 7
72
Konstantin Busch - LSU72 From the principle of inclusion-exclusion:
73
Konstantin Busch - LSU73
74
Konstantin Busch - LSU74 Number of primes between 1…100:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.