Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Problem: Given a set of n points in Rd, preprocess them such that reporting or counting the k points inside a d-dimensional axis-parallel box will be most efficient. " Y 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. Range tree solution:" In a one-dimensional world, points are real numbers and the query is two numbers (a,b)." " Sort points." " Construct a binary balanced tree, storing the points in its leaves. " " Each tree node stores the largest value of its left sub-tree." Simple O(logn) algorithm:" a " Preprocessing: Sort points in O(nlogn)." " Query: (Binary) search for a and b in list in O(logn).! " " List all values inbetween." b -4 -2 01 3 5 1 -2 5 Cannot be easily generalized to higher dimensions (why not ?)." 4- -4 -2 0 0 3 1 3 7 5 35. -4 Mark the vertex at which the search paths diverge as V-split. " -4 Build a data structure storing a “small” number of canonical subsets, such that:" 1 -2 -2 5 0 0 V-split 3 7 5 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. " The c.s. may overlap." " Every query may be answered as the union of a “small” number of c.s." The geometry of the space enables this." 3 1 11 45. Input Range: 3.5-8.2 Required time for finding a leaf: O(log n)." Find the two boundaries of the given range in the leaves u and v. " Report all the leaves in maximal subtrees between u and v." 7 7 Two extremes:" 11 " Singletons – O(k) query time, even for counting." " Power set – O(1) query time. O(2n) storage." 65. 7 11 15 7 Given a set of points in 2D." Bound the points by a rectangle." Split the points into two (almost) equal size groups, using a horizontal or vertical line." Continue recursively to partition the subsets, until they are small enough." Canonical subsets are subtrees." V-split 24 canonical subset {9,12,14,15} 3 1 1 4 {3} 3 12 {4,7} 4 {17,20} 14 9 7 9 12 14 17 15 17 20 27 20 25 22 {22} 22 24 25 29 27 29 31 v u 2 23 canonical subsets are subtrees 75. L6 L4 A Partitions 2D space into axis-aligned rectangular regions." Nodes represent partition lines, and leaves represent input points." L2 85. L1 F E B G C L4 L3 H D L7 L5 L1 construction complexity: L2 L3 L4 A L5 B C E L7 F G 2 H " Counting: Add its count." " Reporting: Report entire subtree." A B C D L3 D L6 E 2 F L7 H D L8 B L7 4 2 L5 C H L3 D L6 E F 2 L7 G H 105. k nodes are reported. How much time is spent on internal nodes? The nodes visited are those that are stabbed by R but not contained in R. How many such nodes are there ?" Theorem: Every side of R stabs O(√n) cells of the tree." Proof: Extend the side to a full line (WLOG - horizontal): " " In the first level it stabs two children." " In the next level it stabs (only) two of the four grandchildren. " Thus, the recursive equation is:" " 3 Total query time: O(√n + k)." L8 G L3 I L7 5 LL55 E G H L5 2 2 B L2 C 9 LL11 L6 F A R 2 LL44 L1 L4 A G L5 F L3 2 L4 L6 E B L2 C 4 L6 D A L2 95. Given an axis-parallel range query R, search for this range in the tree. " Traverse only subtrees which represent regions intersecting R." If a subtree is contained entirely in R:" L4 Each node in the tree defines an axis-parallel rectangle in the plane, bounded by the lines marked by this vertexʼs ancestors." Label each node with the 8 number of points in that L1 rectangle. " L1 2 I 115. 125. 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.