### Lowest Common Ancestor – Tarjan’s off-line algorithm

2021

We have a tree $G$ with $n$ nodes and we have $m$ queries of the form $(u, v)$. For each query $(u, v)$ we want […]

### Solve RMQ (Range Minimum Query) by finding LCA (Lowest Common Ancestor)

2021

Given an array A[0..N-1]. For each query of the form [L, R] we want to find the minimum in the array A starting from position L and ending with position R. We will […]

### Lowest Common Ancestor – Farach-Colton and Bender Algorithm

2021

Let $G$ be a tree. For every query of the form $(u, v)$ we want to find the lowest common ancestor of the nodes $u$ […]

### Lowest Common Ancestor – Binary Lifting

2021

Let $G$ be a tree. For every query of the form (u, v) we want to find the lowest common ancestor of the nodes u and v, i.e. we want […]

### Lowest Common Ancestor

2021

1. Lowest Common Ancestor – $O(\sqrt{N})$ and $O(\log N)$ with $O(N)$ preprocessing Given a tree $G$. Given queries of the form $(v_1, v_2)$, for each […]

### Second best Minimum Spanning Tree – Using Kruskal and Lowest Common Ancestor

2021

A Minimum Spanning Tree $T$ is a tree for the given graph $G$ which spans over all vertices of the given graph and has the […]