Lazyselect

1,109 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,109
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
3
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • Lazyselect

    1. 1. LAZYSELECT 09M6358
    2. 2. n Q p
    3. 3. 3 5 2 7 1 6 4 8
    4. 4. n=8 3 5 2 7 1 6 4 8
    5. 5. n=8 3 5 2 7 1 6 4 8
    6. 6. n=8 3 5 2 7 1 6 4 8
    7. 7. n=8 3 Q. 5 A(n = 8) 2 7 1 p=5 A. 5 6 4 8
    8. 8. QUICKSELECT : O(n) SELECT : O(n)
    9. 9. LAZYSELECT
    10. 10. LAZYSELECT O(n)
    11. 11. 1. A n ( n < 50), A , p . A n3/4 , B .
    12. 12. A
    13. 13. n
    14. 14. n n = 500
    15. 15. n 3/4 n = 500
    16. 16. n 3/4 n = 500
    17. 17. n 3/4 n = 500 n = 106
    18. 18. B n = 106
    19. 19. n n = 50
    20. 20. p
    21. 21. p p
    22. 22. 2. A p B q=pn3/4/n=pn-1/4 . , l=max{ q- √n , 0}, h=min{ q+√n ,n3/4} ( , q √n ) ,B l L h H ( B LAZYSELECT .)
    23. 23. B n = 106
    24. 24. B p q
    25. 25. q= pn3/4 / n
    26. 26. q= pn-1/4
    27. 27. q= pn-1/4
    28. 28. q
    29. 29. q
    30. 30. -√n +√n q
    31. 31. -√n +√n q L H
    32. 32. l = max{ q - √n , 0} h = min{ q + √n , n3/4 }
    33. 33. B l L B h H
    34. 34. LAZYSELECT B l L B h H LAZYSELECT
    35. 35. 3. A , A A[i]<H A1 A2 (QUICKSORT partition ). A1 |A1| p , A2 p-|A1| (A2 LAZYSELECT ). |A1|≧p , A1 A[i]<L A11 A12 . |A11|≧p A11 p (A11 LAZYSELECT ). , A12 p-|A11| (A12 LAZYSELECT ).
    36. 36. A
    37. 37. A H
    38. 38. A1 A2 H
    39. 39. A1 A2 ? P
    40. 40. A1 A2 |A1| P
    41. 41. A2 P’ = P - |A1|
    42. 42. A2 P’ = P - |A1|
    43. 43. A1 A2 P ≦ |A1|
    44. 44. A1 A2 L
    45. 45. A11 A12 A2 L
    46. 46. A11 A12 A2 ? P
    47. 47. A1 A11 A12 A2 LAZYSELECT LAZYSELECT LAZYSELECT or or p’ = p p’ = p - |A11| p’ = p - |A1|
    48. 48. n3/4 √n
    49. 49. A11 A2 A12
    50. 50. p A11 A2 A12
    51. 51. O(n)

    ×