147
The set-covering problem
2. From these, pick the set with the smallest number of stations that
covers all 50 states.
The problem is, it takes a long time to calculate every possible subset
of stations. It takes O(2^
n
) time, because there are 2^
n
stations. It’s
possible to do if you have a small set of 5 to 10 stations. But with all
the examples here, think about what will happen if you have a lot of
items. It takes much longer if you have more stations. Suppose you can
calculate 10 subsets per second.
There’s
no algorithm that solves it fast enough!
What can you do?
Dostları ilə paylaş: