I found a paper on a quad tree constant time neighbor found algorithm [here.][1] But iI figured that I only need one part of the algorithm, I don't actually need to find the neighbors, I just need the neighbor level differences which seems to be set in this part of the algorithm:

![alt text][2]
However, I don't understand where or how the level differences are being set, can someone explain this bit of pseudocode to me?
[1]: http://www.lcad.icmc.usp.br/~jbatista/procimg/quadtree_neighbours.pdf
[2]: /storage/temp/23424-qtlcld.png
↧