changeset 221:c1ce849e6417 working

add merge test
author sugi
date Wed, 27 Mar 2013 22:58:11 +0900
parents 9fe7afd7d292
children f4aaada20712
files src/alice/test/codesegment/local/bitonicsort/SetInfo.java src/alice/test/codesegment/local/bitonicsort/Sort.java src/alice/test/codesegment/local/bitonicsort/SortTest.java
diffstat 3 files changed, 31 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/alice/test/codesegment/local/bitonicsort/SetInfo.java	Wed Mar 27 21:14:59 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/SetInfo.java	Wed Mar 27 22:58:11 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	Wed Mar 27 21:14:59 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/Sort.java	Wed Mar 27 22:58:11 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	Wed Mar 27 21:14:59 2013 +0900
+++ b/src/alice/test/codesegment/local/bitonicsort/SortTest.java	Wed Mar 27 22:58:11 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);
 	    
 	}
 }