mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-22 19:36:06 +00:00
Bug fixes and improvements (#1572)
* Sync zh and zh-hant versions. * Remove the polyfill.io link from mkdocs.yml * Update contributors' info for code reviewers and en/zh-hant versions reviewers. * Fix graph.md * Update avatars for English version reviewers. * Sync zh and zh-hant versions. * Fix two_sum_brute_force.png * Sync zh and zh-hant versions. Optimize structrue of index.html. * Format index.html
This commit is contained in:
@@ -105,7 +105,7 @@ public class min_path_sum {
|
||||
|
||||
// 暴力搜尋
|
||||
int res = MinPathSumDFS(grid, n - 1, m - 1);
|
||||
Console.WriteLine("從左上角到右下角的做小路徑和為 " + res);
|
||||
Console.WriteLine("從左上角到右下角的最小路徑和為 " + res);
|
||||
|
||||
// 記憶化搜尋
|
||||
int[][] mem = new int[n][];
|
||||
@@ -114,14 +114,14 @@ public class min_path_sum {
|
||||
Array.Fill(mem[i], -1);
|
||||
}
|
||||
res = MinPathSumDFSMem(grid, mem, n - 1, m - 1);
|
||||
Console.WriteLine("從左上角到右下角的做小路徑和為 " + res);
|
||||
Console.WriteLine("從左上角到右下角的最小路徑和為 " + res);
|
||||
|
||||
// 動態規劃
|
||||
res = MinPathSumDP(grid);
|
||||
Console.WriteLine("從左上角到右下角的做小路徑和為 " + res);
|
||||
Console.WriteLine("從左上角到右下角的最小路徑和為 " + res);
|
||||
|
||||
// 空間最佳化後的動態規劃
|
||||
res = MinPathSumDPComp(grid);
|
||||
Console.WriteLine("從左上角到右下角的做小路徑和為 " + res);
|
||||
Console.WriteLine("從左上角到右下角的最小路徑和為 " + res);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ public class heap {
|
||||
/* 初始化堆積 */
|
||||
// 初始化小頂堆積
|
||||
PriorityQueue<int, int> minHeap = new();
|
||||
// 初始化大頂堆積(使用 lambda 表示式修改 Comparator 即可)
|
||||
PriorityQueue<int, int> maxHeap = new(Comparer<int>.Create((x, y) => y - x));
|
||||
// 初始化大頂堆積(使用 lambda 表示式修改 Comparer 即可)
|
||||
PriorityQueue<int, int> maxHeap = new(Comparer<int>.Create((x, y) => y.CompareTo(x)));
|
||||
Console.WriteLine("以下測試樣例為大頂堆積");
|
||||
|
||||
/* 元素入堆積 */
|
||||
|
||||
Reference in New Issue
Block a user