Input Range: 3.5-8.2 Build a Data Structure Storing A

Input Range: 3.5-8.2 Build a Data Structure Storing A

Problem: Given a set of n points in Rd, preprocess them such that reporting or counting the k points Y inside a d-dimensional axis-parallel box will be most efficient. " ! Desired output-sensitive query time complexity – O(k+f(n)) for reporting and O(f(n)) for counting, where f(n)=o (n), e.g. f(n)=logn." X ! Sample application: Report all cities within 100 mile radius of Boston." 15. 25. ! In a one-dimensional world, points are !Range tree solution:" real numbers and the query is two " ! Sort points." numbers (a,b)." " ! Construct a binary balanced tree, storing the points in its -4 -2 0 1 3 5 7 11 ! Simple O(logn) algorithm:" " ! Preprocessing: Sort points in O(nlogn)." a b leaves. " " ! Query: (Binary) search for a and b in list # " ! Each tree node stores the 1 in O(logn).! largest value of its left sub-tree." " " List all values inbetween." -2 5 ! Cannot be easily generalized to higher dimensions (why not ?)." 4- 0 3 7 -4 -2 0 1 3 5 7 11 35. 45. Input Range: 3.5-8.2 !Build a data structure storing a “small” number of ! Required time for finding a leaf: O(log canonical subsets, such that:" n)." 1 ! Find the two boundaries of the given " ! The c.s. may overlap." range in the leaves u and v. " " ! Every query may be answered as the union of a “small” V-split ! Report all the leaves in maximal -2 5 number of c.s." subtrees between u and v." !The geometry of the space enables this." ! Mark the vertex at which the search -4 0 3 7 paths diverge as V-split. " !Two extremes:" " ! Singletons – O(k) query time, even for counting." -4 -2 0 1 3 5 7 11 " ! Power set – O(1) query time. O(2n) storage." ! Continue to find the two boundaries, reporting values in the subtrees:" "When going left (right), report the entire right (left) subtree." ! When reaching a leaf, check it exhaustively." 55. 65. 1 ! Given a set of points in 2D." 15 V-split ! Bound the points by a rectangle." ! Split the points into two (almost) equal size groups, using a horizontal or vertical line." 7 canonical subset 24 {9,12,14,15} ! Continue recursively to partition the subsets, until they are small enough." 3 12 20 27 ! Canonical subsets are subtrees." {4,7} {17,20} 1 4 9 14 17 {22} 22 25 29 {3} 1 3 4 7 9 12 14 15 17 20 22 24 25 27 29 31 u v 2 23 canonical subsets are subtrees 75. 85. L6 L4 L1 F L1 L6 A E L4 ! Partitions 2D space into B F ! Each node in the tree defines axis-aligned rectangular H L A E G 3 regions." L2 C an axis-parallel rectangle in the B D plane, bounded by the lines ! Nodes represent partition H L3 marked by this vertex$s L G lines, and leaves represent 2 C ancestors." L7 input points." L5 D L ! Label each node with the 7 L5 L 8 1 number of points in that# L1 rectangle. " construction complexity: L2 L3 4 4 L2 L3 L4 L5 L6 L7 2 2 2 2 L4 L5 L6 L7 A B C D E F G H A B C D E F G H 95. 105. L1 L6 ! Given an axis-parallel L4 F ! k nodes are reported. How much time is spent on internal nodes? range query R, search The nodes visited are those that are stabbed by R but not R A E for this range in the tree. " B contained in R. How many such nodes are there ?" ! Traverse only subtrees L3 ! Theorem: Every side of R stabs O(√n) cells of the tree." L C G H which represent regions 9 2 LL11 ! Proof: Extend the side to a full line (WLOG - horizontal): " intersecting R." L8 D " ! In the first level it stabs two children." ! If a subtree is contained L5 I L " ! In the next level it stabs (only) two of the four grandchildren. " entirely in R:" 4 5 7 L2 L3 " ! Thus, the recursive equation is:" " ! Counting: Add its count." " ! Reporting: 2 2 2 3 LL44 LL55 L6 L7 Report entire ! Total query time: O(√n + k)." subtree." 2 A B C D E F G L8 H I 115. 125. 2 !For a d-dimensional space:" " ! Construction time: O(d nlogn)." " ! Space Complexity: O(dn)." " ! Query time complexity: O(dn1-1/d+k)." Question: Are kd trees useful for non-orthogonal range queries, e.g. disks, convex polygons ? Fact: Using interval trees, orthogonal range queries may be solved in O(logd-1n+k) time and O(nlogd-1n) space. 135. 3 .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us