贪心算法

机器学习中大量使用贪心算法
🦄
  • Greedy algorithm works only if the local optimum is equal to the global optimum.
  • Greedy algorithm does not guarantee optimal solutions.  However, it generally produces solutions that are very close in value (heuristics) to the optimal, and hence is intuitively appealing when finding the optimal solution takes too much time.
notion image
使用动态规划进行分析
notion image
  • Algorithm gives non-overlapping intervals
  • The result is optimal
假设我们的最优解,贪心算法一定不会更差
notion image
这个动态规划不正确,第一个活动中的情况是
notion image
  1. Cast the optimization problem as one in which we make a choice and are left with one subproblem to solve.
  1. Prove that there is always an optimal solution to the original problem that makes the greedy choice, so that the greedy choice is always safe.
  1. Demonstrate optimal substructure by showing that, having made the greedy choice, what remains is a subproblem with the property that if we combine an optimal solution to the subproblem with the greedy choice we have made, we arrive at an optimal solution to the original problem.
哈夫曼编码
notion image
选出来的第一个元素可以被包含
出现频率更小的字符放在更深的位置里面
Loading...
fufu酱
fufu酱
一个爱折腾的大学生
公告
👋
欢迎 欢迎来到fufu酱的blog! 💞️我是22级浙江大学竺可桢学院计算机科学与技术专业的学生 一个爱折腾的大学生 🌱我会在这个网站上更新我的笔记和工具分享 🌈目前all in MLLM 📫你可以用下面的方式联系到我
🍀
今後ともよろしくお願いします