1 / 58

Randomized Algorithms presentation

2004 spring. Randomized Algorithms presentation. B90902036 許 平 B90902050 郭煜楓 B90902057 陳文祥. Randomized Selection in n+C+o(n) comparisons. Alexandros V. Gerbessiotis CS Department, New Jersey Institute of Technology, Newark Constantinos J. Siniolakis

Télécharger la présentation

Randomized Algorithms presentation

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. 2004 spring Randomized Algorithmspresentation B90902036許 平B90902050郭煜楓B90902057陳文祥

  2. Randomized Selection in n+C+o(n)comparisons • Alexandros V. Gerbessiotis CS Department, New Jersey Institute of Technology, Newark • Constantinos J. Siniolakis The American College of Greece, 6 Gravias St., Aghia Paraskevi, Athens, 15342, Greece. Randomzied Algorithm

  3. Part 1 Introduction

  4. Introduction • With high probability for any constantρ > 1 requires n + C + o(n) comparisons to determine the C-th order statistic of n keys • Reduced by extending the algorithm of Floyd and Rivest and analyzing its resulting performance more carefully Randomzied Algorithm

  5. Selection in O(n) : BFPRT algorithm • M. Blum • R. W. Floyd • V. R. Pratt • R. L. Rivest • R. E. Tarjan • 1973 • T(n) < c‧n Randomzied Algorithm

  6. BFPRT algorithm • 1. Divide the items into floor(n/5) groups of5itemseach. Last group can be smaller. • 2. Find the median of each group(usingsorting). • 3. Use SELECT to recursively find themedian of the floor(n/5) group medians. Randomzied Algorithm

  7. BFPRT algorithm • 4. Partition the input by using thismedian-of-median as pivot. • 5. Suppose low side of the partition has selements, and high side has n - s elements. • 6. If k ≤s, recursively call SELECT(k) onlow side; otherwise, recursively callSELECT(k - s) on high side. Randomzied Algorithm

  8. BFPRT algorithm • Analysis : • x = pivot • At least half the medians are ≥ x • At least half of the floor(n/5) groups contributeat least3 items tothe high side. • |Item|≥ x are at least Randomzied Algorithm

  9. BFPRT algorithm • Recursive call to SELECT is on sizeat most7n/10 + 6. • Step 3 has a recursive call T(n/5), and • Step 5 has a recursive call T(7n/10 + 6). Randomzied Algorithm

  10. BFPRT algorithm • Inductively verify that T(n) ≤ cnfor scome constant c • T(n) ≤ c(n/5) + c(7n/10 + 6) + O(n) ≤ 9cn/10 + 6c + O(n) ≤ cn • In above, choose c so that c(n/10 - 6) beatsthe function O(n) for all n. Randomzied Algorithm

  11. Part 1.5 The scenario of our random selection algorithm

  12. Step 1. Random Sampling • 1. Let Y be randomly chosen subset of size2λ -1 < n/2 from X • 2. sort y in little time ! |X| = n |Y| = 2λ - 1 Randomzied Algorithm

  13. Step 2. 左護法 右護法 • Assume : 2cλ > μ/2 for λ≧1, μ≧1 • L = y2cλ- μ/2 • R = y2cλ+ μ/2 • X0 = { x | x ∈ X and x < L } • X1 = { x | x ∈ X and L < x < R } • X2 = { x | x ∈ X and x > R } Randomzied Algorithm

  14. Part 2 Claim

  15. Sampling result X Y X0 X1 X2 Randomzied Algorithm

  16. Probabilistic express • |X0| = n0 , |X2| = n2 • P0(j) : the probability that n0 = j • P2(j) : the probability that n2 = j Randomzied Algorithm

  17. Claim 1 Randomzied Algorithm

  18. That is … • P0(j) : 左護法 = j • P2(j) : 右護法 = N – J – 1 X0 左 X1 右 X2 Randomzied Algorithm

  19. That is … |X| = n |Y| = 2λ - 1 Randomzied Algorithm

  20. That is … L = y 2cλ- μ/2 X0 = j Select L-1 numbers into X0 from y Randomzied Algorithm

  21. That is … = Randomzied Algorithm

  22. Our goal • Establishing lower and upper bounds on the sizes of X0 and X2 , we guarantee that therequired statistic is located in set X1. • Proving that the probability of having such a set of size less than cn– f(n) for some functionf(n)of n is negligible Randomzied Algorithm

  23. Proposition 1 • Proposition 1 • Let C ≤ N/2 , c = C/N . λ≥ 1, μ≥ 6, 2λ-1 < N/2 n ≥ N, 2cλ>μ/2, ρ>1 if f(N) = (Nμ) / ( 2λ) and μ= 2 ( 3ρ2cλlogn ) ^ 0.5 prove P( |X0| > cN + f(N) – 1 ) ≥ 1- n^(1- ρ) Randomzied Algorithm

  24. Proposition 1 • Def Randomzied Algorithm

  25. Proposition 1 • 證明 剩下證明 Randomzied Algorithm

  26. Proposition 1 • 首先可以知道 接下來要用一個特殊的方法來算出上面那條等式的上界 Randomzied Algorithm

  27. Proposition 1 • 觀察下列這道等式 可以看出 可以被視作為從 N 個物件裡, 取出 2λ-1個, 其中第 2cλ-μ/2個最大是 B 的機率 (…附註1) Randomzied Algorithm

  28. 附註1 Concrete Math, p169, (5.26) l = N – 1, k = j, q = 0 m = 2(1-c)λ+μ/2 -1 n = 2cλ-μ/2 -1 Randomzied Algorithm

  29. Proposition 1 • Let q = ( 2λ-1 ) / N . 在 N 的數中選出 2λ-1 的數, 每個數被選中的機率. 定義 p.s 前 j 個數中取 2cλ-μ/2-1 個數 取第 j+1 個數 , 一定是 2cλ-μ/2 th in sorted X 後 N-j-1 的數中取 2(1-c)λ+μ/2-1 個數 Randomzied Algorithm

  30. Lemma1 Let Randomzied Algorithm

  31. Lemma1-proof B.Bollobas. Random Graphs. Academic Press, New York, 1984 d = N, c = 2λ-1, a = q = (2λ-1)/N b = 1 - a Randomzied Algorithm

  32. lemma2 我們要使用 generating function 的方法, 來證上面的式子 將上面那項當作是 多項式 ((1-q)+qx)^j 的 x^(2cλ-μ/2 -1) 係數 Randomzied Algorithm

  33. lemma2-proof 那我們要求的方程式就會是 的 x^(2cλ-μ/2 -1) 係數 Randomzied Algorithm

  34. lemma2-proof D. Angluin and L. G. Valiant. Fast probabilistic algorithms for hamiltonian circuits and matchings. Journal of Computer and System Sciences, 18:155-193,1979 Randomzied Algorithm Set 2cλ-μ/2 = ( 1+β)(B+1)q … β< 1 ? 見 lemma 3 可以得到hint

  35. lemma3 Let f(N) = Nμ/(2λ) 因為c=C/N>0 可以省略 Randomzied Algorithm

  36. Proposition 1 (…lemma1) (…lemma2 ) (…lemma1) (…lemma4) (後面兩項可以省略 因為都小於 1) 因為2λ-1<N/2 , 所以前面兩項相乘 < n Randomzied Algorithm

  37. lemma3-review Let f(N) = Nμ/(2λ) 因為c=C/N>0 可以省略 Randomzied Algorithm

  38. lemma4 Randomzied Algorithm

  39. Lemma4-proof 剩下證 Randomzied Algorithm

  40. Claim 2 • If Then • Proof : • Similarly inequation as Proposition 1, set f(n)=0, B = cn => Randomzied Algorithm

  41. Claim 3 • If Then • Proof : • Symmetric as Claim 2 Randomzied Algorithm

  42. Claim 4 • If Then • Proof : • Similarly inequation as Proposition 1 Randomzied Algorithm

  43. Claim 5 • If Then • Proof : • Similarly inequation as Proposition 1 • c -> (1-c) • Same lower bound for μ: Randomzied Algorithm

  44. Part 3 Algorithm

  45. begin SELECT (X, C) letc = C/n, λ= , such that let select randomly a sample denote by if ( ) then let else let let fori = 1 to n do if ( ) then Line 1 ~ 11

  46. let else if ( ) then let else let if ( ) then return SELECT_DET( ); else reexecute procedure SELECT; Line 12~20

  47. Step 1: Sampling Original input : n numbers X A sample of 2λ+1 numbers S

  48. Step 2 : sort S S

  49. if ( ) let else let let Line 5~8 Randomzied Algorithm

  50. Partition S using m and M m C M Rl Rr S m M Randomzied Algorithm

More Related