Aizawa Kunio, Tanaka Shojiro
Department of Mathematics and Computer Science, Interdisciplinary Faculty of Science and Engineering, Shimane University, Matsue, Shimane, 690-8502 Japan.
IEEE Trans Pattern Anal Mach Intell. 2009 Jul;31(7):1178-83. doi: 10.1109/TPAMI.2008.145.
Quadtrees and linear quadtrees are well-known hierarchical data structures to represent square images of size 2(r) x 2(r). Finding the neighbors of a specific leaf node is a fundamental operation for many algorithms that manipulate quadtree data structures. In quadtrees, finding neighbors takes O(r) computational time for the worst case, where r is the resolution (or height) of a given quadtree. Schrack [1] proposed a constant-time algorithm for finding equal-sized neighbors in linear quadtrees. His algorithm calculates the location codes of equal-sized neighbors; it says nothing, however, about their existence. To ensure their existence, additional checking of the location codes is needed, which usually takes O(r) computational time. In this paper, a new algorithm to find the neighbors of a given leaf node in a quadtree is proposed which requires just O(1) (i.e., constant) computational time for the worst case. Moreover, the algorithm takes no notice of the existence or nonexistence of neighbors. Thus, no additional checking is needed. The new algorithm will greatly reduce the computational complexities of almost all algorithms based on quadtrees.
四叉树和线性四叉树是用于表示大小为2(r)×2(r)的方形图像的著名分层数据结构。对于许多操作四叉树数据结构的算法而言,找到特定叶节点的邻居是一项基本操作。在四叉树中,在最坏情况下找到邻居需要O(r)的计算时间,其中r是给定四叉树的分辨率(或高度)。施拉克[1]提出了一种用于在线性四叉树中找到等大小邻居的常数时间算法。他的算法计算等大小邻居的位置码;然而,它没有提及这些邻居的存在性。为了确保它们的存在,需要对位置码进行额外检查,这通常需要O(r)的计算时间。本文提出了一种在四叉树中找到给定叶节点邻居的新算法,该算法在最坏情况下仅需要O(1)(即常数)的计算时间。此外,该算法不关注邻居的存在与否。因此,无需额外检查。新算法将大大降低几乎所有基于四叉树的算法的计算复杂度。