A partial implementation of an augmented interval tree for finding overlapping ranges in O(log n + k) time.
Add this line you your application's Gemfile:
gem 'interval_tree', github: 'glosie/interval_tree'
tree = IntervalTree::Tree.new([1..2, 2..3, 3..5, 5..6])
tree.search(3..4)
# => [2..3, 3..5]
- support insertions and deletions