Skip to content

Commit e2b433a

Browse files
j>=0 should be the first condition since c use shortciruit & operator
1 parent 6134e0f commit e2b433a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sort/insertion_sort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int main(){
1616
for(i=1;i<s;i++){
1717
temp=a[i];
1818
j=i-1;
19-
while((temp<a[j])&&(j>=0)){
19+
while((j>=0) && (temp<a[j])){
2020
a[j+1]=a[j];
2121
j=j-1;
2222
}

0 commit comments

Comments
 (0)