Skip to content
DSA Visualizerpreview

Interval scheduling (earliest finish first)

Always take the interval that finishes first among those that still fit.

O(n log n) for the sort time · O(1) extra space

Intervals1-4, 3-5, 0-6, 5-7, 3-9, 6-10, 8-11, 12-16

Pick as many non-overlapping intervals as possible from 1–4, 3–5, 0–6, 5–7, 3–9, 6–10, 8–11, 12–16.

Intervals 1–4, 3–5, 0–6, 5–7, 3–9, 6–10, 8–11, 12–16. Chosen so far: none.
  • compare
  • swap or write
  • settled

1 / 11

Speed

Space play · ← → step · Home End jump · drag the strip to scrub