Skip to content

Commit d438341

Browse files
committed
Update best case complexity of sharing map operations
Since the sharing map is now a variable-height tree, the best case complexity of various operations has changed.
1 parent 618deb4 commit d438341

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/util/sharing_map.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class sharing_mapt
249249
///
250250
/// Complexity:
251251
/// - Worst case: O(H * S + M)
252-
/// - Best case: O(H)
252+
/// - Best case: O(1)
253253
///
254254
/// \param k: The key of the element to erase
255255
void erase(const key_type &k);
@@ -258,7 +258,7 @@ class sharing_mapt
258258
///
259259
/// Complexity:
260260
/// - Worst case: O(H * S + M)
261-
/// - Best case: O(H)
261+
/// - Best case: O(1)
262262
///
263263
/// \param k: The key of the element to erase
264264
void erase_if_exists(const key_type &k)
@@ -271,7 +271,7 @@ class sharing_mapt
271271
///
272272
/// Complexity:
273273
/// - Worst case: O(H * S + M)
274-
/// - Best case: O(H)
274+
/// - Best case: O(1)
275275
///
276276
/// \param k: The key of the element to insert
277277
/// \param m: The mapped value to insert
@@ -282,7 +282,7 @@ class sharing_mapt
282282
///
283283
/// Complexity:
284284
/// - Worst case: O(H * S + M)
285-
/// - Best case: O(H)
285+
/// - Best case: O(1)
286286
///
287287
/// \param k: The key of the element to insert
288288
/// \param m: The mapped value to replace the old value with
@@ -306,7 +306,7 @@ class sharing_mapt
306306
///
307307
/// Complexity:
308308
/// - Worst case: O(H * log(S) + M)
309-
/// - Best case: O(H)
309+
/// - Best case: O(1)
310310
///
311311
/// \param k: The key of the element to search
312312
/// \return optionalt containing a const reference to the value if found
@@ -350,7 +350,7 @@ class sharing_mapt
350350
///
351351
/// Complexity:
352352
/// - Worst case: O(H * log(S) + M)
353-
/// - Best case: O(H)
353+
/// - Best case: O(1)
354354
bool has_key(const key_type &k) const
355355
{
356356
return get_leaf_node(k)!=nullptr;

0 commit comments

Comments
 (0)