Interval Tree: Timeline, Tree Nodes and Search Cost Against Brute Force (2D)
The same search as a flat diagram: the intervals on a timeline with the probe, the tree below it with visited, reported and pruned nodes coloured, and charts of visited nodes against the probe position, the reported intervals against the numerical expectation and the tree height against n.
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.
The same search as a flat diagram: the intervals on a timeline with the probe, the tree below it with visited, reported and pruned nodes coloured, and charts of visited nodes against the probe position, the reported intervals against the numerical expectation and the tree height against n.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install