1 / 78

Advanced Counting Techniques

Advanced Counting Techniques. CSC-2259 Discrete Structures. Recurrence Relations. Sequence. Recurrence relation:. For any. Example:. Recurrence relation. Solutions to recurrence relation:. Example:. $10,000 bank deposit. %11 interest. :amount after years. Example:.

clangley
Télécharger la présentation

Advanced Counting Techniques

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU

  2. Recurrence Relations Sequence Recurrence relation: For any Konstantin Busch - LSU

  3. Example: Recurrence relation Solutions to recurrence relation: Konstantin Busch - LSU

  4. Example: $10,000 bank deposit %11 interest :amount after years Konstantin Busch - LSU

  5. Example: Fibonacci sequence Konstantin Busch - LSU

  6. Example: Towers of Hanoi bar1 bar2 bar3 discs Goal: move all discs to bar3 Rule: not allowed to put larger discs on top of smaller discs Konstantin Busch - LSU

  7. bar1 bar2 bar3 Step 1: move recursively discs to bar2 Konstantin Busch - LSU

  8. bar1 bar2 bar3 Step 2: move largest disc to bar3 Konstantin Busch - LSU

  9. bar1 bar2 bar3 Step 3: move recursively discs to bar3 Konstantin Busch - LSU

  10. :total disc moves 2 recursive calls with discs (steps 1&3) movement of largest disc (step 2) one move for one disc Konstantin Busch - LSU

  11. Konstantin Busch - LSU

  12. Solving Linear Recurrence Relations Linear homogeneous recurrence relation of degree : Constant coefficients: Konstantin Busch - LSU

  13. A sequence (solution) satisfying the relation is uniquely determined by the initial values: (these are different constants than the coefficients) Konstantin Busch - LSU

  14. Solution to recurrence relation: if an only if divide both sides with characteristic equation Konstantin Busch - LSU

  15. characteristic equation: factorize with roots characteristic roots: Multiple possible solutions: Konstantin Busch - LSU

  16. The solutions may not satisfy the initial conditions Konstantin Busch - LSU

  17. Theorem: Recurrence relation of degree 2 has unique solution where are solutions to the characteristic equation, and are constants that depend on initial conditions Konstantin Busch - LSU

  18. Proof: Characteristic Equation Roots: Konstantin Busch - LSU

  19. First compute from initial conditions Konstantin Busch - LSU

  20. Konstantin Busch - LSU

  21. Prove by induction that Basis cases: true for the specific choices of Konstantin Busch - LSU

  22. Inductive hypothesis: assume that for all Inductive step: prove that for Konstantin Busch - LSU

  23. By (strong) inductive hypothesis: Konstantin Busch - LSU

  24. By recurrence relation definition Inductive hypothesis characteristic equations End of Proof Konstantin Busch - LSU

  25. Example: Fibonacci sequence Has solution: Characteristic roots: Konstantin Busch - LSU

  26. Konstantin Busch - LSU

  27. Konstantin Busch - LSU

  28. Degree recurrence relation: has unique solution where are solutions to the characteristic equation, and are constants that depend on initial conditions Konstantin Busch - LSU

  29. Example: Solution: Characteristic equation: Roots: Konstantin Busch - LSU

  30. Final solution: Konstantin Busch - LSU

  31. Recurrence Relations for Divide and Conquer Algorithms Typical divide and conquer algorithm: • Input of size • Divide into sub-problems • each of size • Combine sub-problems with cost Konstantin Busch - LSU

  32. Divide an conquer recurrence relation: Cost of subproblem of size Konstantin Busch - LSU

  33. Examples: Binary search: Merge Sort: Fast Matrix Multiplication (Stassen’s Alg.): Konstantin Busch - LSU

  34. Theorem: if then Konstantin Busch - LSU

  35. Proof: Konstantin Busch - LSU

  36. Konstantin Busch - LSU

  37. End of Proof Konstantin Busch - LSU

  38. Theorem: if then Konstantin Busch - LSU

  39. Proof: From previous theorem Konstantin Busch - LSU

  40. Case: Konstantin Busch - LSU

  41. Case: End of Proof Konstantin Busch - LSU

  42. Example: Binary search: Konstantin Busch - LSU

  43. Master Theorem: if then Konstantin Busch - LSU

  44. Example: Merge Sort: Konstantin Busch - LSU

  45. Example: Fast Matrix Multiplication (Stassen’s Alg.): Konstantin Busch - LSU

  46. Generating Functions Find number of solutions for: Answer: Konstantin Busch - LSU

  47. Alternative solution choices for choices for choices for Konstantin Busch - LSU

  48. Alternative solution is the total number of solutions to equation Konstantin Busch - LSU

  49. Another problem: Find total number of solutions which satisfy: Konstantin Busch - LSU

  50. Alternative solution choices for choices for choices for Konstantin Busch - LSU

More Related