Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

ISBN: 0201844524, 978-0201844528

More Books

Students also viewed these Databases questions