Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

数据结构与算法-动态规划与贪心算法 #6

Open
tianma630 opened this issue Apr 22, 2020 · 0 comments
Open

数据结构与算法-动态规划与贪心算法 #6

tianma630 opened this issue Apr 22, 2020 · 0 comments
Labels

Comments

@tianma630
Copy link
Owner

tianma630 commented Apr 22, 2020

本文基于《javascript数据结构与算法》一书

动态规划

动态规划(Dynamic Programming,DP)是一种将复杂问题分解成更小的子问题来解决的优化技术。用动态规划解决问题时,要遵循三个重要步骤:

  1. 定义子问题;
  2. 实现要反复执行而解决子问题的部分;
  3. 识别并求解出边界条件。

插入排序就是动态规划的思想

贪心算法

贪心算法遵循一种近似解决问题的技术,期盼通过每个阶段的局部最优选择(当前最好的 解),从而达到全局的最优(全局最优解)。它不像动态规划那样计算更大的格局。

@tianma630 tianma630 added javascript javascript 算法 and removed javascript javascript labels Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant