Fading Coder

One Final Commit for the Last Sprint

Heavy-Light Decomposition for Range Queries on Trees

Dynamic operations that mix path updates and queries on a tree defeat simple prefix‑sum or difference‑based preprocessing. Heavy‑light decomposition (HLD) assigns each vertex to a heavy path and gives every path, as well as every complete subtree, a contiguous interval in a preorder. By flattening t...

Advanced Algorithmic Strategies in Competitive Programming

This article summarizes several challenging competitive programming problems, showcasing various algorithmic techniques from dynamic programming and data structures to number theory and tree algorithms. Each problem explores distinct optimization strategies and mathematical insights. Problem 1: Reso...

Lowest Common Ancestor Algorithms for Tree Structures

Binary Search Tree Scenario Leverage the ordering property where left descendants contain smaller values than their parent, while right descendants contain larger values. Starting from the root, compare target node values with the current node to determine the traversal direction. Recursive imppleme...