mrhooray/kdtree-rs

Question: Why swap_remove?

odarbelaeze opened this issue · 1 comments

I see you use swap remove here https://github.com/mrhooray/kdtree-rs/blob/master/src/kdtree.rs#L268, I was wondering why is that, if you iterate over a vector using swap remove, you'll pop the first element and make the last element first, and so forth, this will end up on removing the first element and then exhausting the array in reverse order.

What's the algorithmic difference with like iterating over the points in forward order, or in reverse order using pop for instance?

None. Using into_iter wod have work just as well. I think I did it that way in some branch.