Greedy mind map

Make locally optimal choices for global solutions.

Core idea: Take a local move only when an exchange or stay-ahead argument says an optimum can include it.

Mnemonic: Prove safe → commit → never revisit · Cost: Usually sort O(n log n)

Order: Sort into safety

Signal: One ordering exposes a choice that leaves maximum room for the future.

Move: Sort by finish, deadline, or another proof-bearing key, then accept compatible choices.

Examples: Non-overlapping Intervals, Activity Selection, Queue Reconstruction

Extend: Best reachable frontier

Signal: Only the furthest or cheapest reachable state matters so far.

Move: Scan while maintaining the strongest frontier; fail when the scan outruns it.

Examples: Jump Game, Gas Station, Partition Labels

Pair: Commit one side

Signal: Sorted extremes can be matched and one side cannot benefit from waiting.

Move: Pair when possible; always advance the endpoint whose fate is already determined.

Examples: Boats to Save People, Assign Cookies, Two City Scheduling

Schedule: Best available resource

Signal: Jobs arrive over time and a heap can choose among currently legal options.

Move: Sort releases, add available work, then pop the locally safest job or resource.

Examples: Task Scheduler, Single-Threaded CPU, Meeting Rooms

Every mind map