Home▸Algorithms & AI▸Interval Tree: Max-End Augmentation, Stabbing Queries and Subtree Pruning

Interval Tree: Max-End Augmentation, Stabbing Queries and Subtree Pruning

A wooden timeline board carries brass rails, one per stored interval, while the same intervals hang behind them as sapphire nodes of a binary search tree ordered by start, each node remembering the largest end below it. A probe sweeps along the board and the tree is searched at every position: nodes that contain the probe turn green, nodes visited in vain turn yellow, and whole subtrees whose largest end lies left of the probe, or whose starts lie right of it, are skipped. Choose stabbing or window queries, the number and length of intervals, and a balanced or insertion-order tree, and compare the visited nodes with the n checks of brute force. Seven independent numerical checks cover the search against brute force, the augmentation, the cost bound, the balanced height and an integral for the expected number of hits.

Algorithms & AI3DModerate60 FPS📱 Mobile-adapted🟠 Blender⇄ 2D version
Interval Tree: Max-End Augmentation, Stabbing Queries and Subtree Pruning ↗ Open standalone

A wooden timeline board carries brass rails, one per stored interval, while the same intervals hang behind them as sapphire nodes of a binary search tree ordered by start, each node remembering the largest end below it. A probe sweeps along the board and the tree is searched at every position: nodes that contain the probe turn green, nodes visited in vain turn yellow, and whole subtrees whose largest end lies left of the probe, or whose starts lie right of it, are skipped. Choose stabbing or window queries, the number and length of intervals, and a balanced or insertion-order tree, and compare the visited nodes with the n checks of brute force. Seven independent numerical checks cover the search against brute force, the augmentation, the cost bound, the balanced height and an integral for the expected number of hits.

⚙ Under the hood

A wooden timeline board carries brass rails, one per stored interval, while the same intervals hang behind them as sapphire nodes of a binary search tree ordered by start, each node remembering the largest end below it. A probe sweeps along the board and the tree is searched at every position: nodes that contain the probe turn green, nodes visited in vain turn yellow, and whole subtrees whose largest end lies left of the probe, or whose starts lie right of it, are skipped. Choose stabbing or window queries, the number and length of intervals, and a balanced or insertion-order tree, and compare the visited nodes with the n checks of brute force. Seven independent numerical checks cover the search against brute force, the augmentation, the cost bound, the balanced height and an integral for the expected number of hits.

Interval treeData structuresBinary search treeStabbing queryAlgorithmsAugmented tree

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)