This note describes a very simple O(1) query time algorithm for finding level ancestors. This is basically a serial (re)-implementation of the parallel algorithm. Earlier, Menghani and Matani described another simple algorithm; however, their algorithm takes O(log n) time to answer queries. Although the basic algorithm has preprocessing time of O(n\log n), by having additional levels, the preprocessing time can be reduced to almost linear or linear.
翻译:本说明描述了查找水平祖先的非常简单的 O(1) 查询时间算法。 这基本上是平行算法的序列( 重新) 。 早些时候, Mengani 和 Matani 描述了另一个简单的算法; 但是, 他们的算法需要O( log n) 时间来回答查询。 虽然基本的算法有O( n\log n) 预处理时间, 增加一个级别, 预处理时间可以缩短为几乎线性或线性。