diff --git a/codes/rust/chapter_computational_complexity/space_complexity.rs b/codes/rust/chapter_computational_complexity/space_complexity.rs index a65ebb748..37064fcd3 100644 --- a/codes/rust/chapter_computational_complexity/space_complexity.rs +++ b/codes/rust/chapter_computational_complexity/space_complexity.rs @@ -21,6 +21,9 @@ fn constant(n: i32) { fn linear(n: i32) { // 长度为 n 的数组占用 O(n) 空间 let nums = vec![0; n as usize]; + // 长度为 n 的列表占用 O(n) 空间 + // TODO + // 长度为 n 的哈希表占用 O(n) 空间 let map: HashMap<_, _> = (0..n).map(|i| (i, format!("{}", i))).collect(); }