Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

(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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions