forked from itcharge/AlgoNote
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] main from itcharge:main #15
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9bea1cd
更新题解列表
itcharge 9627f49
更新章节列表
itcharge 8127501
Update 0035. 搜索插入位置.md
itcharge 6fe2fa9
Update 0004. 寻找两个正序数组的中位数.md
itcharge 523d068
Update 0128. 最长连续序列.md
itcharge 2f0f572
Update 0215. 数组中的第K个最大元素.md
itcharge 6702825
Update 0303. 区域和检索 - 数组不可变.md
itcharge 79bf079
Update 0307. 区域和检索 - 数组可修改.md
itcharge a48c8fd
Update 0370. 区间加法.md
itcharge 75de141
Update 0715. Range 模块.md
itcharge afde623
Update 0912. 排序数组.md
itcharge 6304f12
Update 1099. 小于 K 的两数之和.md
itcharge 5c18ff7
Update 1109. 航班预订统计.md
itcharge c1f4f6d
Update 1310. 子数组异或查询.md
itcharge 23362c9
Update 剑指 Offer II 119. 最长连续序列.md
itcharge 5e64245
Update 0300. 最长递增子序列.md
itcharge 4b7e493
Update 0118. 杨辉三角.md
itcharge df8e274
Update 0118. 杨辉三角.md
itcharge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
更新章节列表
- Loading branch information
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## 1. 线性 DP 简介 | ||
|
||
> **线性 DP**:具有「线性」阶段划分的动态规划方法统称为线性动态规划(简称为「线性 DP」)。 | ||
> | ||
> - 如果状态包含多个维度,则每个维度都是线性划分的阶段,也属于线性 DP。 | ||
|
||
## 2. 线性 DP 的应用 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## 1. 背包问题简介 | ||
|
||
> **背包问题**:背包问题是线性 DP 中一类经典而又特殊的模型。背包问题可以描述为:给定一组物品,每种物品都有自己的重量和价格,在限定的总重量内,我们如何选择,才能使得物品的总价格最高。 | ||
|
||
## 2. 01 背包问题 | ||
|
||
> **01 背包问题描述**:一共有 `n` 件物品,其中第 `i` 件物品的体积为 `c[i]`,价值为 `w[i]`。现在有一个容量为 `V` 的背包,请问在总容量不超过背包容量上限的情况下,能装入背包的最大价值是多少? | ||
|
||
## 3. 完全背包问题 | ||
|
||
> **完全背包问题**:一共有 `n` 种物品,每种物品有无限多个,其中第 `i` 件物品的体积为 `c[i]`,价值为 `w[i]`。现在有一个容量为 `V` 的背包,请问在总容量不超过背包容量上限的情况下,能装入背包的最大价值是多少? | ||
|
||
## 4. 多重背包问题 | ||
|
||
> **多重背包问题**:一共有 `n` 种物品,其中第 `i` 种物品的件数为 `m[i]`,每件物品的体积为 `c[i]`,价值为 `w[i]`。现在有一个容量为 `V` 的背包,请问在总容量不超过背包容量上限的情况下,能装入背包的最大价值是多少? | ||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 1. 区间 DP 简介 | ||
|
||
> **区间 DP**:线性 DP 的一种,以「区间长度」划分阶段,以两个坐标(区间的左、右端点)作为状态的维度。一个状态通常由被它包含且比它更小的区间状态转移而来。 | ||
|
||
## 2. 区间 DP 的应用 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## 1. 树形 DP 简介 | ||
|
||
> **树形 DP**:在树形结构上实现的动态规划方法叫做树形 DP。树形 DP 的求解过程一般以节点从深到浅(子树从小到大)的顺序作为动态规划的「阶段」。将节点编号作为状态的第 1 维,代表以该节点为根的子树。 | ||
> | ||
> 通常我们采用递归的方式求解每棵子树,在回溯时从子节点向上进行状态转移。在当前节点的所有子树求解完毕之后,才可以求解当前节点。 | ||
|
||
## 2. 树形 DP 的应用 |
Empty file removed
Contents/10.Dynamic-Programming/07.Number-DP/01.Number-DP.md
Empty file.
5 changes: 5 additions & 0 deletions
Contents/10.Dynamic-Programming/07.State-DP/01.State-DP.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 1. 状态压缩 DP 简介 | ||
|
||
> **状态压缩 DP**:如果使用动态规划方法设计的状态是一个大小不超过 `n` 的集合,并且集合中的每个元素都是小于 `k` 的正整数,则我们可以把这个集合看做是一个 `n` 位的 `k` 进制数,以一个 $[0, k^n - 1]$ 之间的十进制整数的形式作为动态规划状态的一维。这种把集合转化为整数记录在动态规划状态中的一类方法,被称为状态压缩动态规划方法。 | ||
|
||
## 2. 状态压缩 DP 的应用 |
File renamed without changes.
5 changes: 5 additions & 0 deletions
Contents/10.Dynamic-Programming/08.Count-DP/01.Count-DP.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 1. 计数类 DP 简介 | ||
|
||
> **计数类 DP**:统计可行方案数的一类动态规划,区别于求解最优解,计数类 DP需要统计所有满足条件的可行解数量,这些问题需要满足不重复、不遗漏的条件。 | ||
|
||
## 2. 计数类 DP 的应用 |
File renamed without changes.
Empty file removed
Contents/10.Dynamic-Programming/08.State-DP/01.State-DP.md
Empty file.
7 changes: 7 additions & 0 deletions
Contents/10.Dynamic-Programming/09.Number-DP/01.Number-DP.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## 1. 数位 DP 简介 | ||
|
||
> **数位 DP**:与数位相关的一类计数类动态规划,即在数位上进行动态规划。这里的数位指的是个位、十位、百位、千位等。 | ||
> | ||
> - 数位 DP 一般用来统计区间 `[l, r]` 上满足特定条件的元素个数,或者用于求解满足特定条件的第 `k` 小数。 | ||
|
||
## 2. 数位 DP 的应用 |
File renamed without changes.
Empty file removed
Contents/10.Dynamic-Programming/09.Probability-DP/01.Probability-DP.md
Empty file.
Empty file removed
Contents/10.Dynamic-Programming/10.Count-DP/01.Count-DP.md
Empty file.
Empty file removed
Contents/10.Dynamic-Programming/10.Count-DP/02.Count-DP-List.md
Empty file.
5 changes: 5 additions & 0 deletions
Contents/10.Dynamic-Programming/10.Probability-DP/01.Probability-DP.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 1. 概率 DP 简介 | ||
|
||
> **概率 DP**:与概率相关的一类动态规划。由于概率和期望具有线性性质,使得可以在概率和期望之间建立一定的递推关系,从而通过动态规划的方式来解决一些概率问题。 | ||
|
||
## 2. 概率 DP 的应用 |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.