algorithm - Finding all the intervals that does not overlap with the point -


i have intervals of form (a1, b1), (a2, b2), ...., (an, bn).
support following operations

  1. adding new interval.
  2. deleting existing interval.
  3. given point, find intervals not overlap point.

intervals tree straightforward solution if want find intervals overlap point. case when want find non intersecting intervals?

have nodes in 2 trees simultaneously. tree holds them key ai , tree b holds them key bi.
insertion , deletion o(log n).
requirement 3, print nodes in b smallest biggest , stop when bi still smaller point. same, backwards, in a.

example:
given (1,10), (5,18), (13,20), , point 12.
interval(s) in ai bigger 12 (13,20), , in b interval(s) smaller (1,10).


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -