advanced algorithms coms31900 orthogonal range searching
play

Advanced Algorithms COMS31900 Orthogonal Range Searching Rapha el - PowerPoint PPT Presentation

Advanced Algorithms COMS31900 Orthogonal Range Searching Rapha el Clifford Slides by Benjamin Sach Orthogonal range searching A 2D range searching data structure stores n distinct ( x, y ) -pairs and supports: the lookup ( x 1 , x 2 ,


  1. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  2. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  3. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  4. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  5. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  6. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  7. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  8. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67 67 > 64 = x 2

  9. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67

  10. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67 k lookups take O (log n + k ) time ( k is the number of points reported)

  11. Starting simple. . . 1D range searching build a sorted array containing the x -coordinates in O ( n log n ) preprocessing (prep.) time and O ( n ) space to perform lookup ( x 1 , x 2 ) . . . find the successor of x 1 by binary search and then ‘walk’ right x 1 = 15 x 2 = 64 3 3 7 11 19 23 27 35 43 53 61 67 n 3 7 11 19 23 27 35 43 53 61 67 k lookups take O (log n + k ) time ( k is the number of points reported) this is called being ‘output sensitive’

  12. Starting simple. . . 1D range searching

  13. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . .

  14. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle

  15. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . half the points are to the left half the points are to the right find the point in the middle

  16. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle

  17. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half

  18. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half

  19. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half

  20. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half (in a tie, pick the left)

  21. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half (in a tie, pick the left)

  22. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half (in a tie, pick the left)

  23. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half (in a tie, pick the left)

  24. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half (in a tie, pick the left) We can store the tree in O ( n ) space (it has one node per point)

  25. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . find the point in the middle . . . and recurse on each half (in a tie, pick the left) We can store the tree in O ( n ) space (it has one node per point) It has O (log n ) depth

  26. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . O (log n ) find the point in the middle . . . and recurse on each half (in a tie, pick the left) We can store the tree in O ( n ) space (it has one node per point) It has O (log n ) depth

  27. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . O (log n ) find the point in the middle . . . and recurse on each half (in a tie, pick the left) We can store the tree in O ( n ) space (it has one node per point) It has O (log n ) depth and can be built in O ( n log n ) time

  28. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . O (log n ) find the point in the middle . . . and recurse on each half (in a tie, pick the left) We can store the tree in O ( n ) space (it has one node per point) It has O (log n ) depth and can be built in O ( n log n ) time

  29. Starting simple. . . 1D range searching alternatively we could build a balanced tree. . . O (log n ) find the point in the middle . . . and recurse on each half (in a tie, pick the left) We can store the tree in O ( n ) space (it has one node per point) It has O (log n ) depth and can be built in O ( n log n ) time ( O ( n ) time if the points are sorted)

  30. Starting simple. . . 1D range searching how do we do a lookup?

  31. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2

  32. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 Step 1: find the successor of x 1

  33. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 Step 1: find the successor of x 1

  34. Starting simple. . . 1D range searching how do we do a lookup? x 1 is to the left x 1 x 2 Step 1: find the successor of x 1

  35. Starting simple. . . 1D range searching how do we do a lookup? x 1 is to the right x 1 x 2 Step 1: find the successor of x 1

  36. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 Step 1: find the successor of x 1

  37. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 Step 1: find the successor of x 1 in O (log n ) time

  38. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 Step 2: find the predecessor of x 2

  39. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 Step 2: find the predecessor of x 2

  40. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 Step 2: find the predecessor of x 2

  41. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 Step 2: find the predecessor of x 2

  42. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2

  43. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  44. Starting simple. . . 1D range searching how do we do a lookup? x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  45. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  46. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  47. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  48. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  49. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  50. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  51. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  52. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  53. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  54. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  55. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  56. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  57. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  58. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  59. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  60. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  61. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  62. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path after the split this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output?

  63. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path after the split this is called an off-path edge “it’s all or nothing” x 1 x 2 in O (log n ) time Step 1: find the successor of x 1 in O (log n ) time Step 2: find the predecessor of x 2 which points in the tree should we output? those in the O (log n ) selected subtrees on the path

  64. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path after the split this is called an off-path edge “it’s all or nothing” x 1 x 2

  65. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path after the split this is called an off-path edge “it’s all or nothing” x 1 x 2 as before lookups take O (log n + k ) time ( k is the number of points reported)

  66. Starting simple. . . 1D range searching how do we do a lookup? look at any node on the path after the split this is called an off-path edge “it’s all or nothing” x 1 x 2 as before lookups take O (log n + k ) time ( k is the number of points reported) so what have we gained?

  67. Subtree decomposition root Warning: the root to split path isn’t to scale too big split off-path edge too small x 1 x 2 off-path subtree

  68. Subtree decomposition root Warning: the root to split path isn’t to scale too big split off-path edge too small x 1 x 2 off-path subtree after the paths to x 1 and x 2 split. . .

  69. Subtree decomposition root Warning: the root to split path isn’t to scale too big split off-path edge too small x 1 x 2 off-path subtree after the paths to x 1 and x 2 split. . . any off-path subtree is either in or out

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend