# A Simple Solution to the Level-Ancestor Problem

**Authors:** Gaurav Menghani, Dhruv Matani

arXiv: 1903.01387 · 2021-11-09

## TL;DR

This paper introduces a straightforward method for solving the level-ancestor problem in trees, achieving efficient pre-processing and query times with simplicity suitable for teaching and implementation.

## Contribution

It presents a simple, easy-to-understand solution with linear pre-processing and logarithmic query time, contrasting with more complex existing algorithms.

## Key findings

- Pre-processing time is O(n).
- Query time is O(log n).
- Solution is simple and easy to implement.

## Abstract

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(\log\ {n})$ time. Though other optimal algorithms exist, this is a simple enough solution that could be taught and implemented easily.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1903.01387/full.md

## Figures

1 figure with captions in the complete paper: https://tomesphere.com/paper/1903.01387/full.md

## References

4 references — full list in the complete paper: https://tomesphere.com/paper/1903.01387/full.md

---
Source: https://tomesphere.com/paper/1903.01387