Question: 13. The question refers to a Quadtree constructed for for storing a set of points (as discussed in the slides). Let S be a set


13. The question refers to a Quadtree constructed for for storing a set of points (as discussed in the slides). Let S be a set of points, all from the 2h 2h grid. Let T be a quadtree constructed on S, as shown in the slides. Let Q be a query rectangle (given to you by lower-left and upper right corners). The operation count(T, Q) reports |QnS| (the number of points of S which are also inside Q) Suggest a slight modification of T, such that when a new query is given, you could compute count(T, Q) efficiently. Write a recursive peudocode for the operation count(v, Q), where v is a node of T. The first call to this function is with count(root(T), Q) Note that we are not interested in which points of S lie inside Q. Only in their number. Your code should be as efficient as possible (and would not be accepted otherwise) Bonus 5 points: show that the running time is O(kh) where h is the height of T, and k is the number of nodes w such that R(w) CQ and R(parent (w))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
