diff --git a/codes/wangtiaoke/20510324.java b/codes/wangtiaoke/20510324.java new file mode 100644 index 0000000000000000000000000000000000000000..296f54517791e75657a43f7c40aa58f92cbd6c84 --- /dev/null +++ b/codes/wangtiaoke/20510324.java @@ -0,0 +1,11 @@ +public static void bubbleSort(int[] a, int n) { + for (int j = n - 1; j > 0; j--) { + for (int i = 0; i < j; i++) { + if (a[i] > a[i + 1]) { + int temp = a[i]; + a[i] = a[i + 1 ]; + a[i + 1] = temp; + } + } + } +}