checking in interval trees, Red Black trees and BFS