A Simple Solution to the Level-Ancestor Problem

03/04/2019
by   Gaurav Menghani, et al.
0

A Level Ancestory query LA(u, d) asks for the the ancestor of the node u at a depth d. We present a simple solution, which pre-processes the tree in O(n) time with O(n) extra space, and answers the queries in O(n) time. Though other optimal algorithms exist, this is a simple enough solution that could be taught and implemented easily.

READ FULL TEXT

Please sign up or login with your details

Forgot password? Click here to reset