mirror of
https://github.com/krahets/hello-algo.git
synced 2026-09-03 21:57:14 +00:00
Bug fixes and improvements (#1380)
* preorder, inorder, postorder -> pre-order, in-order, post-order * Bug fixes * Bug fixes * Update what_is_dsa.md * Sync zh and zh-hant versions * Sync zh and zh-hant versions. * Update performance_evaluation.md and time_complexity.md * Add @khoaxuantu to the landing page. * Sync zh and zh-hant versions * Add @ khoaxuantu to the landing page of zh-hant and en versions.
This commit is contained in:
@@ -10,7 +10,7 @@ fn dfs(nums: &[i32], target: i32, i: i32, j: i32) -> i32 {
|
||||
if i > j {
|
||||
return -1;
|
||||
}
|
||||
let m: i32 = (i + j) / 2;
|
||||
let m: i32 = i + (j - i) / 2;
|
||||
if nums[m as usize] < target {
|
||||
// 遞迴子問題 f(m+1, j)
|
||||
return dfs(nums, target, m + 1, j);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/* 移動一個圓盤 */
|
||||
fn move_pan(src: &mut Vec<i32>, tar: &mut Vec<i32>) {
|
||||
// 從 src 頂部拿出一個圓盤
|
||||
let pan = src.remove(src.len() - 1);
|
||||
let pan = src.pop().unwrap();
|
||||
// 將圓盤放入 tar 頂部
|
||||
tar.push(pan);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user