1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 |
<br> public
class BubbleSortLib { public
int [] Sort( int [] arr) { for
( int
outer = arr.Length - 1; outer > 0; outer--) { for
( int
inner = 0; inner < outer; inner++) { if
(arr[inner] > arr[inner + 1]) { int
temp = arr[inner]; arr[inner] = arr[inner + 1]; arr[inner + 1] = temp; } } } return
arr; } } |
原文地址:http://www.cnblogs.com/sumg/p/3753569.html