mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 12:07:51 +00:00
Merge pull request #5115 from katafrakt/smallest-description
Fix description of CountTable's smallest
This commit is contained in:
@@ -954,7 +954,7 @@ proc inc*[A](t: var CountTable[A], key: A, val = 1) =
|
||||
inc(t.counter)
|
||||
|
||||
proc smallest*[A](t: CountTable[A]): tuple[key: A, val: int] =
|
||||
## returns the largest (key,val)-pair. Efficiency: O(n)
|
||||
## returns the (key,val)-pair with the smallest `val`. Efficiency: O(n)
|
||||
assert t.len > 0
|
||||
var minIdx = 0
|
||||
for h in 1..high(t.data):
|
||||
@@ -1080,7 +1080,7 @@ proc inc*[A](t: CountTableRef[A], key: A, val = 1) =
|
||||
t[].inc(key, val)
|
||||
|
||||
proc smallest*[A](t: CountTableRef[A]): (A, int) =
|
||||
## returns the largest (key,val)-pair. Efficiency: O(n)
|
||||
## returns the (key,val)-pair with the smallest `val`. Efficiency: O(n)
|
||||
t[].smallest
|
||||
|
||||
proc largest*[A](t: CountTableRef[A]): (A, int) =
|
||||
|
||||
Reference in New Issue
Block a user