You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the pseudo-code for distance queries and was wondering why do we have the if statement "if d_s < d". Wouldn't the first leaf to be dequeued by the priority queue be the closest object to the query point? We could just do a break statement when we encounter the first leaf and record it. Wouldn't this aslo be more efficient since I wouldn't have to pop all the content in the priority queue. I have tested out both implementations and they work the same. Is there a particular reason that the pseudo-code is written that way with the if statement "if d_s < d"?
The text was updated successfully, but these errors were encountered:
I think you're right here - great catch! I think it's written that way for simplicity, since the early return is a bit unintuitive. In terms of performance, I don't expect a huge difference since the queue should only have O(tree depth) elements in it, and since that check basically flushes out the queue, it only needs to remove a few elements.
I read the pseudo-code for distance queries and was wondering why do we have the if statement "if d_s < d". Wouldn't the first leaf to be dequeued by the priority queue be the closest object to the query point? We could just do a break statement when we encounter the first leaf and record it. Wouldn't this aslo be more efficient since I wouldn't have to pop all the content in the priority queue. I have tested out both implementations and they work the same. Is there a particular reason that the pseudo-code is written that way with the if statement "if d_s < d"?
The text was updated successfully, but these errors were encountered: