1 / 47

optimal solution minimizing number of $3’s has at most one $3

yes. optimal solution minimizing number of $3’s has at most one $3. ($3 + $3  $5 + $1). has at most two $1’s ($1+$1+$1  $3). has value at most $4 in $1 and $3  has the same number of $5 as greedy sol. no. 8 = 4 + 4 8 = 6 + 1 + 1. yes.

tessa
Download Presentation

optimal solution minimizing number of $3’s has at most one $3

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. yes optimal solution minimizing number of $3’s has at most one $3 ($3 + $3  $5 + $1) has at most two $1’s ($1+$1+$1  $3) has value at most $4 in $1 and $3 has the same number of $5 as greedy sol

  2. no 8 = 4 + 4 8 = 6 + 1 + 1

  3. yes optimal solution minimizing number of $4’s has at most one $4 ($4 + $4  $7 + $1) has at most three $1’s ($1+$1+$1+$1  $4) has value at most $6 in $1 and $4 has the same number of $7 as greedy sol

  4. MAIN IDEA: if there is a counterexample then there is a small counterexample 1<A<B

  5. LEMMA: optimal solution for the smallest counterexample doesn’t contain B E = O1 + OA * A + OB * B E = G1 + GA * A + GB * B E-B = O1 + OA * A + (OB-1)*B E-B = G1 + GA * A + (GB-1)*B

  6. LEMMA: optimal solution for the smallest counterexample doesn’t contain B copies of A (A+A+...+A  B+B+...+B) A copies of 1 (1+1+...+1  A) E  (B-1)*A + (A-1) = A*B-1

  7. MAIN IDEA: if there is a counterexample then there is a small counterexample THEOREM: if there is a counterexample then there is on with E  A*B-1

  8. for all C  AB-1 find optimum (dynamic programming) check if agrees with greedy

  9. LEMMA: greedy solution for the smallest counterexample doesn’t contain A E = O1 + OA * A E = G1 + GA * A + GB * B E-A = O1 + (OA-1)* A E-A = G1 + (GA-1)* A + GB*B

  10. LEMMA: optimal solution for the smallest counterexample doesn’t contain 1 E = O1 + OA * A E = G1 + GB * B E-1 = (O1-1)+ OA * A E-1 = (G1-1)+ + GB * B

  11. LEMMA: If there exists a counterexample, then there exists a counterexample E = OA * A E = G1 + GB * B with OA <B and G1<A

  12. LEMMA: If there exists a counterexample, then there exists a counterexample E = OA * A E = G1 + GB * B with OA <B and G1<A with GB = 1

  13. polynomial-time solution • check if P= B/A A is a counterexample

  14. check if P= B/A A is a counterexample 6 = 5 + 1 = 2*3 yes 8 = 6 + 1 + 1 = 2*4 no 8 = 7 +1 = 2*4 yes

  15. each measurement has 3 outcomes 3 measurements  27 outcomes N=14  2*14 = 28 outcomes

  16. 2/3 S G G G S S 1/3 1/3 1/3

  17. M[i,j] = min { P[j] + min M[k,j] + M[i-k,j] 1ki-1 P[i] + min M[i,k] + M[i,j-k] 1kj-1

  18. K[i,s]  K[i-1,s] if sW[i] and K[i-1,s-W[i]]+V[i]>K[i,s] then K[i,s]  K[i-1,s-W[i]]+V[i]

  19. M(m,n)=m * n - 1 proof: induction on m+n base case m+n=2  m=n=1 ok m * n  m1 * n and m2 * n, by IH (m1*n – 1) + (m2 * n – 1 ) + 1 = m * n -1

  20. binary search tree INSERT DELETE SEARCH 5 4 7 2 depth  running time 1 3

  21. B-tree INSERT DELETE SEARCH 2 5 3 4 7 1 branching factor > 2 * makes balancing easier * efficient for “burst memory” (HDD) uniform depth

  22. B-tree . . . branching factor > 2 * makes balancing easier * efficient for “burst memory” (HDD) 103 . . . 106 109

  23. B-tree every node other than the root has T-1 keys (i.e., T children) every node has  2T-1 keys (i.e., 2T children) if T=2 the number of children is 2,3, or 4

  24. B-tree - insert 10 20 30 23 24 29 25 27 INSERT(T,26)

  25. B-tree - insert 10 20 30 23 24 29 25 27 INSERT(T,26)

  26. B-tree - insert 10 20 30 23 24 29 25 27 INSERT(T,26)

  27. B-tree - insert 10 20 30 23 24 29 25 26 27 INSERT(T,26)

  28. B-tree - insert 10 20 30 23 24 29 25 26 27 full leaf INSERT(T,28)

  29. B-tree - insert 10 20 30 23 24 29 25 26 27 full leaf INSERT(T,28)

  30. B-tree - insert 10 20 30 23 24 29 25 26 27 full leaf INSERT(T,28)

  31. B-tree - insert 20 10 30 23 24 29 25 26 27 full leaf INSERT(T,28)

  32. B-tree - insert 20 10 24 30 23 29 25 26 27 full leaf INSERT(T,28)

  33. B-tree - insert 20 10 24 30 23 26 29 25 27 full leaf INSERT(T,28)

  34. B-tree - insert 20 10 24 30 23 26 29 25 27 28 full leaf INSERT(T,28)

  35. B-tree - insert split proactively 10 20 30 23 24 29 25 27 INSERT(T,26)

  36. B-tree - insert split proactively 20 10 30 23 24 29 25 27 INSERT(T,26)

  37. B-tree - insert split proactively 20 10 30 23 24 29 25 27 INSERT(T,26)

  38. B-tree - insert split proactively 20 10 24 30 23 29 25 27 INSERT(T,26)

  39. B-tree - insert split proactively 20 10 24 30 23 29 25 27 INSERT(T,26)

  40. B-tree - insert split proactively 20 10 24 30 23 29 25 26 27 INSERT(T,26)

  41. B-tree - insert split proactively 20 10 24 30 23 29 25 26 27 INSERT(T,28)

  42. B-tree - insert split proactively 20 10 24 30 23 26 29 25 27 28 INSERT(T,28)

  43. B-tree - insert 2T-1 keys  T-1 and T-1 keys uniform depth – the only operation increasing depth is splitting the root every node other than the root has T-1 keys (i.e., T children) every node has  2T-1 keys (i.e., 2T children)

  44. B-tree - delete 20 10 24 30 23 26 29 25 27 28 DELETE(T,28)

  45. B-tree - delete leaf deletion 20 10 24 30 23 26 29 25 27 DELETE(T,28)

  46. B-tree - delete leaf deletion 20 10 24 30 23 26 29 25 27 DELETE(T,27) ?

More Related