Skip to content

glosie/interval_tree

Repository files navigation

IntervalTree

A partial implementation of an augmented interval tree for finding overlapping ranges in O(log n + k) time.

Installation

Add this line you your application's Gemfile:

gem 'interval_tree', github: 'glosie/interval_tree'

Usage

tree = IntervalTree::Tree.new([1..2, 2..3, 3..5, 5..6])
tree.search(3..4)
# => [2..3, 3..5]

Todo

  • support insertions and deletions