From c20ebb4411487e91c13787f34f7b23501d4f918c Mon Sep 17 00:00:00 2001 From: xblakicex Date: Fri, 13 Jan 2023 20:51:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=88=20style(space=5Fcomplexity):=20add?= =?UTF-8?q?=20Add=20todo=20comments=20rust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rust/chapter_computational_complexity/space_complexity.rs | 3 +++ 1 file changed, 3 insertions(+) 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(); }