Question: Write a C++ program that takes 2 parameters: numpoints , indicating how many data points are to be placed in the tree, and a parameter

Write a C++ program that takes 2 parameters: numpoints, indicating how many data points are to be placed in the tree, and a parameter numprobes, indicating the number of probes into the tree. Read a list of numpoints 4-dimensional integer data points from the standard input then build a k-d tree with those n values using the following method:

1. Accumulate all the data in an array. 2. Find the dimension with the widest range, use it to discriminate on. 3. Find the the median value in that dimension to discriminate on using the QuickSelect algorithm with Lomuto's partitioning method. 4 Separate the data into two subarrays based on that discriminant. 5 Recurses back to step 2 on each subarray until an array has size 10 or smaller.

Send ties going to the left subtree. Lastly reads numprobes 4-dimensional data values, called probes, and for each probe, lists all the data points stored in the bucket where the probe would be found if it were in the tree.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!