C++ Practice [GESP2506 Level 6] Maximum Factor

GESP Level 6 practice, problem of the lowest common ancestor in a binary tree, difficultyGeneral/Advanced−. CCF-GESP C++ Assessment Standards Hong Yang, WeChat public account: Hong Yang’s Programming Class CCF-GESP C++ Assessment Standards Comprehensive Guide – [GESP2506 Level 6] Maximum Factor Problem Requirements Problem Description Given a rooted tree with 10^9 nodes, these nodes are numbered … Read more

Tarjan’s Algorithm for Finding the Lowest Common Ancestor (LCA)

Tarjan's Algorithm for Finding the Lowest Common Ancestor (LCA)

1. Introduction When dealing with tree structures, it is common to encounter the need to find the Lowest Common Ancestor (LCA) of two nodes. The LCA is defined as the furthest node from the root among all common ancestors of the two nodes in the tree (i.e., the node with the maximum depth). For example, … Read more