1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Simple Algorithm for Difficult Problem

Discussion in 'Programming' started by Help Desk, Oct 10, 2005.

  1. #1
    This is a question of coverage. Here's is the smallest example. Let's say you have 4 resources and 4 tasks and 4 days.

    Task A: Days 1 & 2
    Task B: Day 2
    Task C: Day 3
    Task D: Days 1, 2, 3 & 4
    Then your resources (Workers) and which tasks they are qualified for.
    W: Tasks A & D
    X: Task D
    Y: Tasks A, B & C
    Z: Tasks B & D

    Is there a quick way to programmatically see if which tasks (if any) are covered by exactly one worker?
    Help Desk, Oct 10, 2005 IP
  2. exam

    exam Peon

    Likes Received:
    Best Answers:
    Trophy Points:
    Just loop through your workers and increment a counter for who can cover each task. When you're done see if any of the task counters are at "1" for who can cover them. (in this case it would be Task "C". :)
    exam, Oct 10, 2005 IP