Thanks to visit codestin.com Credit goes to github.com
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.
2 parents de706f1 + 1e8f60d commit ff83cd0Copy full SHA for ff83cd0
src/sorting/radixsort.js
@@ -68,7 +68,7 @@
68
}
69
70
/* Count frequency of each array element */
71
- for (j = 0; j < array.length; j += 1) {
+ for (j = 0; j < size; j += 1) {
72
digit = getDigit(array[j], i) || 0;
73
count[digit] += 1;
74
@@ -78,16 +78,16 @@
78
count[j] += count[j - 1];
79
80
81
- /* Move elements to auxilary array */
+ /* Move elements to auxiliary array */
82
var aux = [];
83
- for (j = array.length - 1; j >= 0; j -= 1) {
+ for (j = size - 1; j >= 0; j -= 1) {
84
85
count[digit] -= 1;
86
aux[count[digit]] = array[j];
87
88
89
/* Copy elements back from auxilary array */
90
91
array[j] = aux[j];
92
93
0 commit comments