貪心算法的抽象控制
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
選擇能產生問題最優解的量度標準是使用貪心算法設計求解的核心問題。(Solution)
posted on 2007-06-21 15:46 小鋒 閱讀(321) 評論(0) 編輯 收藏 所屬分類: algorithm