Question: Best First ( BF ) Algorithm Pseudocode of BF algorithm B F ( q ) / * in the following H is a sorted list

Best First (BF) Algorithm
Pseudocode of BF
algorithm BF(q)
/* in the following H is a sorted list where each entry is an MBR
whose sorting key in H is its mindist to q;
pbest is a global variable that keeps the NN found so far. */
insert the MBR of the root in H
while ||q,pbest|| is greater than the smallest mindist in H
??** if pbest=O,||q,pbest||=**?
remove from H the MBR r with the smallest mindist
access the child node u of r
if u is an intermediate node then
insert all the MBRs in u into H
else
if the NN of q in u is closer to q than pbest then
,pbest= the NN of q in u
UsiTng BF algorithm, solve the following task:
There is restaurant dataset which consist of 2 D data points. stored in text file with folllowing data format:
id_1 x_1 y_1
id_2 x_2 y_2
...
id _n x_n y_n
each line includes unique id for a data point, and its geographical coordinates , longitude and latitude. FOr an example an entry in the restaurant dataset "id_1=1 x_1=31.45 y_1=140.5" precisely indicates the location of a shop, with x = longitutde and y = latitude.
we have 200 users are interested in finding nearest restaurant. Their locations are provided in a text file formatted identically to datasets:
id_1 x_1 y_1
id_2 x_2 y_2
...
id_200 x_200 y_200
use BF algorithm to construct a R Tree for the selected dataset then apply the BF algorithm using the R tree to find the nearest neighbor for each query point.
output shuould display following information in different single text output file:
The id, x and y coordinates of the nearest restaurant
"id =12 x =45 y =140.8 for query 1"
The total running time for processing all 200 queries and the average time per query. divide the total running time by 200
 Best First (BF) Algorithm Pseudocode of BF algorithm BF(q) /* in

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!