Skip to content

Commit 7a268f4

Browse files
authored
Update 1.bubbleSort.md
增加c语言实现代码
1 parent fd6155a commit 7a268f4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

1.bubbleSort.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,20 @@ function bubbleSort($arr)
129129
return $arr;
130130
}
131131
```
132+
## 10. C 代码实现
133+
```c
134+
void BubbleSort1(int data[],int n) //n为data长度
135+
{
136+
int t;
137+
for(int i=0;i<n-1;i++){
138+
for(int j=0;j<n-i-1;j++){
139+
if(data[j] > data[j+1])
140+
{
141+
t = data[j+1];
142+
data[j+1] = data[j];
143+
data[j] = t;
144+
}
145+
}
146+
}
147+
}
148+
```

0 commit comments

Comments
 (0)