Skip to content

Commit b73ddb6

Browse files
authored
Update countingsort.lua
1 parent dbf28e9 commit b73ddb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sorting/countingsort.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ return function(
2121
count[i] = 0
2222
end
2323

24-
-- Count then occurrences of each key
24+
-- Count the occurrences of each key
2525
for _, elem in ipairs(list) do
2626
local key = key_function(elem)
2727
count[key - min_key + 1] = count[key - min_key + 1] + 1
2828
end
2929

3030
-- Compute cumulative counts for final positions
31-
for i = 2, ipairs(count) do
31+
for i = 2, #count do
3232
count[i] = count[i] + count[i - 1]
3333
end
3434

0 commit comments

Comments
 (0)