Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(c) Finally, derive the worst case time complexity of the build tree operation shown in lecture (BuildRecurse), for building a K-d tree with n points.
(c) Finally, derive the worst case time complexity of the build tree operation shown in lecture (BuildRecurse), for building a K-d tree with n points. You can assume that there no duplicate points. Your result should be a function of n and must be tighter than O(n3), but does not have to be the tightest upper bound. Show and simplify your work 1Build a tree from a set of points. dim specifies the dimension to split on: 0 for x, 1 for y Returns a pointer to aNode which is the root of the tree.*/ 3 Node* buildTree(points, dim): 4 if points is empty return NULL if (dim else 7 sort points along x-dimension sort points along y-dimension 10 12 13 14 15 16 middle -median point of the sorted points array Node* root = new Node(middle) root->left buildTree(points to the left of middle, other dim) root->right-buildTree(points to the right of middle, other dim) return root
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started