Skip to main content

Interval Search Tree

Operations

  • Insert an interval
  • Search for an interval
  • Delete an interval
  • Interval intersection query: Given an interval (lo, hi), find all intervals (or one interval) in data structure that intersects (lo, hi)

image

image

image

image

Implementation - Use a red-black BST to guarantee performance

operationbruteinterval search treebest in theory
insert interval1log Nlog N
find intervalNlog Nlog N
delete intervalNlog Nlog N
find any one interval that intersects (lo, hi)Nlog Nlog N
find all intervals that intersects (lo, hi)NR log NR + log N