# HG changeset patch # User Shinji KONO # Date 1364396915 -32400 # Node ID f4aaada207121ec26e797d0d9e70177f0c9073bf # Parent c2bf9a71005ef48946aaded74c03691673ffc12c# Parent c1ce849e64174d4a84e80f308046b9fe4cb1af7f merge diff -r c2bf9a71005e -r f4aaada20712 src/alice/test/codesegment/local/bitonicsort/SetInfo.java --- a/src/alice/test/codesegment/local/bitonicsort/SetInfo.java Thu Mar 28 00:07:55 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SetInfo.java Thu Mar 28 00:08:35 2013 +0900 @@ -5,10 +5,11 @@ public class SetInfo extends CodeSegment { private SortConfig conf; - public static String[] range; - public static String[] array; - public static String[] count; + public static String[] range; + public static String[] array; + public static String[] count; public static String[] result; + public SetInfo(SortConfig conf) { this.conf = conf; } diff -r c2bf9a71005e -r f4aaada20712 src/alice/test/codesegment/local/bitonicsort/Sort.java --- a/src/alice/test/codesegment/local/bitonicsort/Sort.java Thu Mar 28 00:07:55 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/Sort.java Thu Mar 28 00:08:35 2013 +0900 @@ -53,7 +53,7 @@ System.out.println("checking ...."); for (int i = 0; i< data.table.length-1; i++){ if (data.table[i] > data.table[i+1]){ - System.out.println("MISS "+data.table[i]+" > "+data.table[i+1]+"Position is "+i); + System.out.println("MISS "+data.table[i]+" > "+data.table[i+1]+" Position is "+i); return; } } diff -r c2bf9a71005e -r f4aaada20712 src/alice/test/codesegment/local/bitonicsort/SortTest.java --- a/src/alice/test/codesegment/local/bitonicsort/SortTest.java Thu Mar 28 00:07:55 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SortTest.java Thu Mar 28 00:08:35 2013 +0900 @@ -5,30 +5,46 @@ public class SortTest { public static void main(String args[]){ - int size = 10; - int MAX = 100; + int size1 = 1000000; + int size2 = 1000; + int MAX = 100000; long t; - DataList list1 = new DataList(size); - DataList list2 = new DataList(size); + DataList list1 = new DataList(size1); + DataList list2 = new DataList(size1); + DataList list3 = new DataList(size2); Random rnd = new Random(); - for (int i = 0; i < size; i++){ + for (int i = 0; i < size1; i++){ int num = rnd.nextInt(MAX); list1.table[i] = num; list2.table[i] = num; } + for (int i = 0; i < size2; i++){ + int num = rnd.nextInt(MAX); + list3.table[i] = num; + } - // stack type quicksort + // bubbleSort + t = System.currentTimeMillis(); + Sort.bubbleSort(list3,0,list3.table.length-1); + System.out.println("bubble sort : "+ (System.currentTimeMillis()-t)+" ms"); + Sort.check(list3); + + // quickSort t = System.currentTimeMillis(); Sort.quickSort(list1,0,list1.table.length-1); - System.out.println("quick sort3 : "+ (System.currentTimeMillis()-t)+" ms"); + System.out.println("quick sort1 : "+ (System.currentTimeMillis()-t)+" ms"); Sort.check(list1); t = System.currentTimeMillis(); - Sort.bubbleSort(list2,0,list2.table.length-1); - System.out.println("bubble sort : "+ (System.currentTimeMillis()-t)+" ms"); + Sort.quickSort(list2,0,list2.table.length-1); + System.out.println("quick sort2 : "+ (System.currentTimeMillis()-t)+" ms"); Sort.check(list2); - + + // merge Test + DataList.merge(list1, list2); + Sort.check(list1); + Sort.check(list2); } }