/algorithm

Primary LanguageC++Apache License 2.0Apache-2.0

Algorithm

1. Stringly-Connnected Component

Tarjan's strongly connected components algorithm : https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm

2. Lowest Common Ancestor(LCA)

2.1 offline

Tarjan LCA: https://www.shuzhiduo.com/A/8Bz8XpQVzx/

Tarjan's off-line lowest common ancestors algorithm: https://en.wikipedia.org/wiki/Tarjan's_off-line_lowest_common_ancestors_algorithm

2.2 online

Range minimum query: https://en.wikipedia.org/wiki/Range_minimum_query

Find LCA in Binary Tree using RMQ in C++: https://www.tutorialspoint.com/find-lca-in-binary-tree-using-rmq-in-cplusplus