From 0319b29e92a630c5f14d5e3208b72fe536b38f43 Mon Sep 17 00:00:00 2001 From: Adrian Mejia Date: Sun, 24 May 2020 08:47:16 -0400 Subject: [PATCH] fix(book/hashset): update hashset space complexity --- book/content/part03/set.asc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/content/part03/set.asc b/book/content/part03/set.asc index 04b95a01..cbe6fe60 100644 --- a/book/content/part03/set.asc +++ b/book/content/part03/set.asc @@ -220,8 +220,8 @@ rehash happens, it will take *O(n)* instead of *O(1)*. A `TreeSet` is always *O( |=== .2+.^s| Data Structure 2+^s| Searching By .2+^.^s| Insert .2+^.^s| Delete .2+^.^s| Space Complexity ^|_Index/Key_ ^|_Value_ -| HashSet ^|- ^|O(n) ^|O(1)* ^|O(1)* ^|O(1)* -| TreeSet ^|- ^|O(n) ^|O(log n) ^|O(log n) ^|O(log n) +| HashSet ^|O(1) ^|- ^|O(1)* ^|O(1) ^|O(n) +| TreeSet ^|O(log n) ^|- ^|O(log n) ^|O(log n) ^|O(n) |=== {empty}* = Amortized run time. E.g. rehashing might affect run time to *O(n)*. // end::table[]