1 / 21

HSR Help

HSR Help. Karl Lieberherr. HSR Asymptotic Growth. n rungs: 0,1,2,3, … ,n-1. 0. M: maximum number of rungs. questions asked: q. jars to break: k. 1. 1 1 2 1 3 4

blanca
Download Presentation

HSR Help

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. HSR Help Karl Lieberherr Asymptotic Growth

  2. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  3. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  4. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  5. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 5 4 3 6 7 0 2 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  6. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 1516 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 5 4 3 7 6 0 2 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 3 Asymptotic Growth

  7. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  8. Magic for now HSR(11,2)=4 M(2,4)=11 * HSR(7,2)=3 M(2,3)=7 HSR(4,1)=3 M(1,3)=4 * * * * * * * * * 0 1 2 3 4 5 6 7 8 9 10 HSR(4,2)=2 M(2,2)=4 HSR(3,1)=2, M(1,2)=3 Asymptotic Growth

  9. HSR(11,2)=4 M(2,4)=11 M(k,q)=n * * * * * * * * * * * * * * * 0 * * * 4 * * * 8 * * * * * * * Claim: For all k,q (k<=q): M(k,q) = Sum[i=0 to k](q choose i) 4 choose 2 = 6 4 choose 1 = 4 4 choose 0 = 1 11 = sum= M(2,4) Asymptotic Growth

  10. HSR Question n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  11. Definition of M • M(0,q): 0 jars to break • M(k,k): k jars to break and q=k questions to ask: use binary search. recurrence: M(k,q) = M(k-1,q-1) + M(k,q-1) M(0,q) = 1 M(k,k) = 2k Asymptotic Growth

  12. M = SF M ~ Modified Pascal SF ~ Sum Formula M(k,q)) = M(k-1,q-1) + M(k,q-1) M(0,q) = 1 M(q, q) = 2^q SF(k,q) = Sum[i=0 to k](q choose i) in Theta(q^k) SF has the following properties: (1) SF(0,q) = q choose 0 = 1 = M(0,q) (2) SF(q, q) = Sum[i=0 to q] q choose i = 2^q = M(q, q) (3) SF(k, q) = SF(k-1, q-1) + SF(k,q-1) Asymptotic Growth

  13. 3rd property (Ahmed) SF(X-1, Y-1) + SF(X-1, Y) = Sum[i=0 to Y-1] X-1 choose i + Sum[i=0 to Y] X-1 choose i = Sum[i=0 to Y-1] X-1 choose i + Sum[i=1 to Y] X-1 choose i + X-1 choose 0 = Sum[i=0 to Y-1] X-1 choose i + Sum[i=0 to Y-1] X-1 choose (i+1) + 1 = Sum[i=0 to Y-1] ( X-1 choose i + X-1 choose (i+1) ) + 1 = Sum[i=0 to Y-1] ( X choose (i+1) ) + 1 = Sum[i=0 to Y-1] ( X choose (i+1) ) + X choose 0 = Sum[i=1 to Y] ( X choose i ) + X choose 0 = Sum[i=0 to Y] ( X choose i ) = SF(X, Y) Therefore, SF(X,Y) = M(X,Y). X=q ,Y=k, switch X and Y Asymptotic Growth

  14. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  15. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  16. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  17. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 5 4 3 6 7 0 2 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 Asymptotic Growth

  18. HSR Asymptotic Growth n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 1516 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 5 4 3 7 6 0 2 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 3 Asymptotic Growth

  19. HSR Iterative n rungs: 0,1,2,3, … ,n-1 0 M: maximum number of rungs questions asked: q jars to break: k 1 1 1 2 1 3 4 1 4 7 8 1 5 11 15 16 1 6 16 26 31 32 1 7 22 42 57 63 64 1 8 29 64 99 120 127 128 0 2 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 1 4 11 1 5 16 1 b c 1 b+1 b+1+c Asymptotic Growth

  20. What is the running time of our decision tree construction algorithm? • Input: (n,k), k<=n • Output: decision tree of minimum depth that correctly determines the highest safe rung for a ladder with rungs 0..n-1 and k jars to break. • Algorithm: • Construct slice of modified Pascal Triangle • Determine tree structure from Pascal Triangle • Fill in rung questions internal to tree • What is its asymptotic running time? Asymptotic Growth

  21. Claim • Alice claims: she can construct DT(n,k) in time O(f(n,k)). • Express bound as a function of output size. Asymptotic Growth

More Related