heyichao@sjzue.edu.cn Greedy Algorithms ● Algorithms for optimization problems typically go through a sequence of steps, with a set of choices at each step. ● Greedy algorithm always makes the choice that looks best at the moment. ● Greedy algorithm makes a locally optimal choice in the hope that this choice will lead to a globally optimal solution. 找钱问题 找钱问题的贪心算法 输入:n种钱币集合S={m1, m2,...,mn}和面值vi,及要找钱数y; 输出: 使目标函数f(X)(钱币张数)达到最小值的钱币集合X。 1. 初始化解集X ← Φ,并计算f(X) ; 2. 按面值将S中的钱币降序排列; 3. 循环: i 从1 到 n , 且钱数还没找完, 做 4. [ 若 v
您可能关注的文档
最近下载
- HB6167.2-2014 民用飞机机载设备环境条件和试验方法 第2部分:温度和高度试验.pdf VIP
- 2023-2024学年苏科版七年级数学下册第7章《平面图形的认识(二)》单元综合测试卷(含答案解析).docx VIP
- 施工现场危险源识别及风险防控方案.docx VIP
- 园林绿化工程招投标书完整版..docx VIP
- 2025年北京信息职业技术学院单招笔试职业能力测验试题库含答案解析.docx VIP
- 第三章本—量—利分析.pptx VIP
- 《本量利分析》课件.pptx VIP
- 2026年1月10日海南省税务局遴选笔试真题及解析.docx VIP
- 机要保密员岗位工作总结7篇.docx VIP
- 图书供应项目售后服务方案.docx VIP
原创力文档

文档评论(0)