procedure greedy(A,n)
//A(1:n)包含n個輸入、、
solution <---null //將解向量初始化為空
for i<---1 to n do
x <---select(A)
if feasible(solution,x)
then solution <--- UNION(solution,x)
endif
repeat
return(solution)
end greedy
選擇能產(chǎn)生問題最優(yōu)解的量度標(biāo)準(zhǔn)是使用貪心算法設(shè)計求解的核心問題。(Solution)