mirror of
https://github.com/krahets/hello-algo.git
synced 2025-01-23 05:54:50 +08:00
add notation of m and n in analysis of complexity (#1621)
* fix: notation of m and n in analysis of complexity As title, complexity variable is not defined previously. * Update dp_solution_pipeline.md * Update dp_solution_pipeline.md --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
parent
98daefa67a
commit
18027ee26c
@ -110,7 +110,7 @@ $$
|
||||
|
||||
![暴力搜索递归树](dp_solution_pipeline.assets/min_path_sum_dfs.png)
|
||||
|
||||
每个状态都有向下和向右两种选择,从左上角走到右下角总共需要 $m + n - 2$ 步,所以最差时间复杂度为 $O(2^{m + n})$ 。请注意,这种计算方式未考虑临近网格边界的情况,当到达网络边界时只剩下一种选择,因此实际的路径数量会少一些。
|
||||
每个状态都有向下和向右两种选择,从左上角走到右下角总共需要 $m + n - 2$ 步,所以最差时间复杂度为 $O(2^{m + n})$ ,其中 $n$ 和 $m$ 分别为网格的行数和列数。请注意,这种计算方式未考虑临近网格边界的情况,当到达网络边界时只剩下一种选择,因此实际的路径数量会少一些。
|
||||
|
||||
### 方法二:记忆化搜索
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user