Skip to content

Commit d4b8410

Browse files
aneubecklook
andauthored
Update crates/consistent-hashing/README.md
Co-authored-by: Luke Francl <[email protected]>
1 parent 0dcb137 commit d4b8410

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/consistent-hashing/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn consistent_hash<Key>(key: Key, i: usize, n: usize) -> usize {
5959
```
6060

6161
`consistent_choose_k` makes `k` calls to `consistent_choose_max` which calls `consistent_hash` another `k` times.
62-
In total, `consistent_hash` is called `k * (k+1) / 2` Utilizing a `O(1)` solution for `consistent_hash` leads to a `O(k^2)` runtime.
62+
In total, `consistent_hash` is called `k * (k+1) / 2` many times. Utilizing a `O(1)` solution for `consistent_hash` leads to a `O(k^2)` runtime.
6363
This runtime can be further improved by replacing the max operation with a heap where popped elements are updated according to the new arguments `n` and `k`.
6464
With this optimization, the complexity reduces to `O(k log k)`.
6565
With some probabilistic bucketing strategy, it should be possible to reduce the expected runtime to `O(k)`.

0 commit comments

Comments
 (0)