Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9299a5

Browse files
committed
array.length -> size
1 parent de706f1 commit f9299a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/sorting/radixsort.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
}
6969

7070
/* Count frequency of each array element */
71-
for (j = 0; j < array.length; j += 1) {
71+
for (j = 0; j < size; j += 1) {
7272
digit = getDigit(array[j], i) || 0;
7373
count[digit] += 1;
7474
}
@@ -80,14 +80,14 @@
8080

8181
/* Move elements to auxilary array */
8282
var aux = [];
83-
for (j = array.length - 1; j >= 0; j -= 1) {
83+
for (j = size - 1; j >= 0; j -= 1) {
8484
digit = getDigit(array[j], i) || 0;
8585
count[digit] -= 1;
8686
aux[count[digit]] = array[j];
8787
}
8888

8989
/* Copy elements back from auxilary array */
90-
for (j = 0; j < array.length; j += 1) {
90+
for (j = 0; j < size; j += 1) {
9191
array[j] = aux[j];
9292
}
9393
}

0 commit comments

Comments
 (0)