Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff83cd0

Browse files
committed
Merge pull requestmgechev#91 from designeng/sorting-radixsort-array-size
Sorting radixsort
2 parentsde706f1 +1e8f60d commitff83cd0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/sorting/radixsort.js

Lines changed: 4 additions & 4 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
}
@@ -78,16 +78,16 @@
7878
count[j]+=count[j-1];
7979
}
8080

81-
/* Move elements toauxilary array */
81+
/* Move elements toauxiliary array */
8282
varaux=[];
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)

[8]ページ先頭

©2009-2025 Movatter.jp