Interval overlap algorithm derived from CLRS red-black tree