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