1 / 22

X i = indicator random variable of the event that i-th person gets his hat back.

X i = indicator random variable of the event that i-th person gets his hat back. E[X i ]=1/20 X=X 1 +…+X 20 E[X] = E[X 1 ] +…+ E[X 20 ] = 1. derangement = permutation with no fixed points  n! / e .

maitland
Download Presentation

X i = indicator random variable of the event that i-th person gets his hat back.

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. Xi = indicator random variable of the event that i-th person gets his hat back. E[Xi]=1/20 X=X1+…+X20 E[X] = E[X1] +…+ E[X20] = 1

  2. derangement = permutation with no fixed points  n! / e  number = permutations with 1 fixed point

  3. derangement = permutation with no fixed points  n! / e  number = permutations with 1 fixed point n  (n-1)! / e  n  (n-1)! / e  0.3678  0.368 n!

  4. Claim: Alice wins only on HHH game. 1/8 - Alice wins, gets $6 7/8 - Alice loses, pays $1= gets -$1 Alice’s expected payoff: (1/8)* 6 + (7/8) * (-1) = - 1/8 Bob has the advantage.

  5. Heap MIN-HEAP-INSERT O(log k) HEAP-EXTRACT-MIN O(log k) P1 Pk …

  6. We will find the array Ai whose first element e is the smallest, output e to B, remove e from Ai, and repeat. We will use a heap H as follows: we find e using Heap-Extract-Min procedure and then add the next element from Ai to H using Min-Heap-Insert procedure. We make n calls to Min-Heap-Insert and n calls to Heap-Extract-Min. Hence the running time is O(n.log k). To simplify the exposition we add  at the end of each array. for i from 1 to k do Pi  1; Max-Heap-Insert( H,[Ai[1],i] ); for j from 1 to n do [e,i]  Heap-Extract-Max (H); Pi Pi + 1; Max-Heap-Insert( H, [Ai [Pi],i] ); add e to B

  7. <

  8. LA1,RAn,LB1,RBnwhile LA<RA do • MA  (LA + RA)/2  • MB  (LB + RB)/2  • if A[MA]<B[MB] then • LA MA + 1, RB MB - 1else • RA MA, LB MB • output smaller of A[LA],B[LB] <

  9. Randomized algorithm for “median” SELECT k-th element for random x 1) =x <x >x R L 2) recurse on the appropriate part

  10. Quick-sort for random x 1) PARTITION =x <x >x R L 2) recurse on both parts

  11. Quick-sort R-QUICK-SORT (A, l, r) x  random element of A[l,r]; q  PARTITION(A,x,l,r); R-QUICK-SORT(A,l,q-1); R-QUICK-SORT(A,q+1,r);

  12. Quick-sort R-QUICK-SORT (A, l, r) x  random element of A[l,r]; q  PARTITION(A,x,l,r); R-QUICK-SORT(A,l,q-1); R-QUICK-SORT(A,q+1,r); How many times is R-QUICK-SORT called?

  13. R-QUICK-SORT (A, l, r) x  random element of A[l,r]; q  PARTITION(A,x,l,r); R-QUICK-SORT(A,l,q-1); R-QUICK-SORT(A,q+1,r); Quick-sort Time spent in PARTITION?

  14. R-QUICK-SORT (A, l, r) x  random element of A[l,r]; q  PARTITION(A,x,l,r); R-QUICK-SORT(A,l,q-1); R-QUICK-SORT(A,q+1,r); Quick-sort Time spent in PARTITION? compare x with all elements in A[l,r] we will count the number of comparisons

  15. R-QUICK-SORT (A, l, r) x  random element of A[l,r]; q  PARTITION(A,x,l,r); R-QUICK-SORT(A,l,q-1); R-QUICK-SORT(A,q+1,r); Quick-sort Time spent in PARTITION? Let the elements of A after sorting be b1 < b2 < … < bn Let Xi,j be the indicator random variable for the event bi is compared to bj.

  16. Quick-sort Time spent in PARTITION? Let the elements of A after sorting be b1 < b2 < … < bn Let Xi,j be the indicator random variable for the event bi is compared to bj. What is the probability that bi and bj are compared in the first round ?

  17. Quick-sort Time spent in PARTITION? Let the elements of A after sorting be b1 < b2 < … < bn Let Xi,j be the indicator random variable for the event bi is compared to bj. What is the probability that bi and bj are compared in the first round ? 2/n (the pivot has to be bi or bj)

  18. Quick-sort Time spent in PARTITION? What is the probability that bi and bj are compared ? 2/(j-i+1) Let bk be the first pivot such that ik j. bi, bj get compared  k=i or k=j k is uniformly random in {i,…,j}

  19. Quick-sort Time spent in PARTITION? What is the probability that bi and bj are compared ? X=  Xi,j 2/(j-i+1) 1i<j n E[Xi,j] = 2/(j-i+1) n 2 2 E[X]=   n = O(n ln n) j-i+1 k k=2 1i<j n

More Related