changeset 223:f4aaada20712 working

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 28 Mar 2013 00:08:35 +0900
parents c2bf9a71005e (current diff) c1ce849e6417 (diff)
children 409d7679cf7b 07a85aaad8e9
files
diffstat 3 files changed, 31 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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;
 	}
--- 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;
 			}
 		}
--- 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);
 	    
 	}
 }