We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dbf28e9 commit b73ddb6Copy full SHA for b73ddb6
src/sorting/countingsort.lua
@@ -21,14 +21,14 @@ return function(
21
count[i] = 0
22
end
23
24
- -- Count then occurrences of each key
+ -- Count the occurrences of each key
25
for _, elem in ipairs(list) do
26
local key = key_function(elem)
27
count[key - min_key + 1] = count[key - min_key + 1] + 1
28
29
30
-- Compute cumulative counts for final positions
31
- for i = 2, ipairs(count) do
+ for i = 2, #count do
32
count[i] = count[i] + count[i - 1]
33
34
0 commit comments