The LCA Problem Revisited Michael A. Bender Martin Farach-Colton Latin American Theoretical Informatics Symposium , pages 88—94, 2000. Speaker: 吳展碩. Introduction. L owest C ommon A ncestor After a O ( n ) time preprocessing , any LCA query can then be answered in O (1) time. Outline.
Structure to Preprocess:
An array A of numbers.
RMQ(i, j) returns the index of the smallest element in the subarray A[i...j].
RMQ(4, 8) = 5.
The RMQ preprocessing of A’ spends O(n/½logn x log(n/½logn)) = O(n) time and space.
min(R1): The minimum from i forward to the end of its block.
min(R2): The minimum of all the blocks in between i’s block and j’s block.
min(R3): The minimum from the beginning of j’s block to j.
Ex: 5676545 => 110001
There are only 2(½logn)-1 = O(n) kinds of binary strings of length (½logn)-1. (Example)