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

page 1

page 2

page 3

research
05/18/2021

Time and Query Optimal Quantum Algorithms Based on Decision Trees

It has recently been shown that starting with a classical query algorith...
research
05/22/2020

Still Simpler Static Level Ancestors

A level-ancestor or LA query about a rooted tree T takes as arguments a ...
research
07/25/2022

Simple O(1) Query Algorithm for Level Ancestors

This note describes a very simple O(1) query time algorithm for finding ...
research
01/21/2023

Diversity of Answers to Conjunctive Queries

Enumeration problems aim at outputting, without repetition, the set of s...
research
06/19/2019

Indexing Graph Search Trees and Applications

We consider the problem of compactly representing the Depth First Search...
research
10/02/2019

Path and Ancestor Queries on Trees with Multidimensional Weight Vectors

We consider an ordinal tree T on n nodes, with each node assigned a d-...
research
03/18/2021

Optimally Summarizing Data by Small Fact Sets for Concise Answers to Voice Queries

Our goal is to find combinations of facts that optimally summarize data ...

Please sign up or login with your details

Forgot password? Click here to reset