diff --git "a/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" "b/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" new file mode 100644 index 0000000000000000000000000000000000000000..ac7e603f607b06a8dea612634ab3d16bac6cb9d2 --- /dev/null +++ "b/1,\350\256\276\347\275\256\350\264\246\345\217\267.bat" @@ -0,0 +1,2 @@ +git config --global user.name "苏瑜煌" +git config --global user.email "1394157072@qq.com" \ No newline at end of file diff --git "a/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" "b/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" new file mode 100644 index 0000000000000000000000000000000000000000..1ec69c41c0deeb98cfd6290e04f42c025b86b003 --- /dev/null +++ "b/2,\345\210\207\346\215\242\345\210\206\346\224\257.bat" @@ -0,0 +1,2 @@ +git branck 39 +git checkout 39 \ No newline at end of file diff --git "a/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" "b/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" new file mode 100644 index 0000000000000000000000000000000000000000..0fbd52fa8111ae13721da1f2c119822552292813 --- /dev/null +++ "b/3,\350\207\252\345\212\250\346\217\220\344\272\244.bat" @@ -0,0 +1,3 @@ +git add . +git commit -m "AutoPush" +git push \ No newline at end of file diff --git a/work/BubbleSort/BubbleSort.class b/work/BubbleSort/BubbleSort.class new file mode 100644 index 0000000000000000000000000000000000000000..9ce42c9266d6625452361139d2a77d1a702a631a Binary files /dev/null and b/work/BubbleSort/BubbleSort.class differ diff --git a/work/BubbleSort/BubbleSort.java b/work/BubbleSort/BubbleSort.java new file mode 100644 index 0000000000000000000000000000000000000000..6aed21c752a5893ee322b33c5736e4faad427e40 --- /dev/null +++ b/work/BubbleSort/BubbleSort.java @@ -0,0 +1,19 @@ +import java.util.*; +public class BubbleSort { + public static void main(String[] args) { + int[] arr = {12,56,3,78,39};//,1,2,5,4,6,7,8,33,22,44,55,66,77 + long n1 = System.nanoTime(); + for (int i = 0; i < arr.length; i++) { + for (int j = 0; j < arr.length - 1 - i; j++) {//ÿѭĵ + if (arr[j] > arr[j + 1]) { + int temp = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = temp; + } + } + } + System.out.println(Arrays.toString(arr)); + long n2 = System.nanoTime(); + System.out.printf("\nðʱ"+(n2-n1)/1000000+"\n"); + } +} \ No newline at end of file diff --git a/work/InsertSort/InsertSort.class b/work/InsertSort/InsertSort.class new file mode 100644 index 0000000000000000000000000000000000000000..9f704a3238c63bbd749203d21e5034e06ec21e2b Binary files /dev/null and b/work/InsertSort/InsertSort.class differ diff --git a/work/InsertSort/InsertSort.java b/work/InsertSort/InsertSort.java new file mode 100644 index 0000000000000000000000000000000000000000..12441f299f959dc53044a1c31bc7772134b3c00f --- /dev/null +++ b/work/InsertSort/InsertSort.java @@ -0,0 +1,27 @@ +import java.util.*; +public class InsertSort{ + public static void main(String[] args) { + int[] array={12,56,3,78,39}; + double n1 = System.nanoTime(); + test(array); + double n2 = System.nanoTime(); + System.out.printf("\nʱ"+(n2-n1)/1000000+"\n"); + } + + public static void test(int[] array) { + int i,j,temp; + for(i=1;i=0;--j) {//ע--jлj-1 + if(temp>array[j]) { + break; + }else { + array[j+1]=array[j]; + } + } + array[j+1]=temp; + } + System.out.println(Arrays.toString(array)); + } +} + diff --git a/work/MergeSort/Main.class b/work/MergeSort/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..2cefec554cf196ebb2ca17909cc12af70f1df685 Binary files /dev/null and b/work/MergeSort/Main.class differ diff --git a/work/MergeSort/Main.java b/work/MergeSort/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..1e5c270ddb6c3b53393b3ee7e9eaab57f8c8d9c2 --- /dev/null +++ b/work/MergeSort/Main.java @@ -0,0 +1,49 @@ +import java.util.Arrays; +public class Main{ + public static void main(String[] args){ + int[] arr = {12,56,3,78,39}; + double n1 = System.nanoTime(); + sort(arr,0,arr.length-1); + System.out.println(Arrays.toString(arr)); + double n2 = System.nanoTime(); + System.out.printf("\n鲢ʱ"+(n2-n1)/1000000+"\n"); + } + + public static int[] sort(int[] a,int low,int high){ + int mid = (low+high)/2; + if(low= pivot) { + high--; + } + // pivot СԪͶ + arr[low] = arr[high]; + while(low 0; step /= 2) { + //һбȽ [step,arr.length) + for (int i = step; i < arr.length; i++) { + int value = arr[i]; + int j; + + //ԲоԪؽбȽ + for (j = i - step; j >= 0 && arr[j] > value; j -= step) { + //jΪȡֵj+stepΪĶӦֵ + arr[j + step] = arr[j]; + } + //ʱstepΪһ[j + step]Ϊϵijʼֵ + arr[j + step] = value; + } + } + } +} \ No newline at end of file diff --git "a/work/\347\256\227\346\263\225\347\224\250\346\227\266/1.png" "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/1.png" new file mode 100644 index 0000000000000000000000000000000000000000..8dd1ac634a16530c3eba6260a6ada4f881242112 Binary files /dev/null and "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/1.png" differ diff --git "a/work/\347\256\227\346\263\225\347\224\250\346\227\266/2.png" "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/2.png" new file mode 100644 index 0000000000000000000000000000000000000000..0ec8c6e0181c8325810ef6548cc09c525ba2c4d0 Binary files /dev/null and "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/2.png" differ diff --git "a/work/\347\256\227\346\263\225\347\224\250\346\227\266/3.png" "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/3.png" new file mode 100644 index 0000000000000000000000000000000000000000..f424b1aaed8f0a26f3a43162962f0cb589300172 Binary files /dev/null and "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/3.png" differ diff --git "a/work/\347\256\227\346\263\225\347\224\250\346\227\266/4.png" "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/4.png" new file mode 100644 index 0000000000000000000000000000000000000000..e80e0f9f8b9dc3edd82a81551ff24a16c1c27770 Binary files /dev/null and "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/4.png" differ diff --git "a/work/\347\256\227\346\263\225\347\224\250\346\227\266/5.png" "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/5.png" new file mode 100644 index 0000000000000000000000000000000000000000..c5d44d6cbf98f08036a3fcedb38962aaf689a617 Binary files /dev/null and "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/5.png" differ diff --git "a/work/\347\256\227\346\263\225\347\224\250\346\227\266/6.png" "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/6.png" new file mode 100644 index 0000000000000000000000000000000000000000..8632a5d5960c5327d9e08120d41687077e18299f Binary files /dev/null and "b/work/\347\256\227\346\263\225\347\224\250\346\227\266/6.png" differ