# HG changeset patch # User sugi # Date 1364474188 -32400 # Node ID 9eaaca2b8a57b3beffa15792e444b91bcd65747a # Parent ddacadba5095c256da92cd9731b1d783e4d9403f change sort method diff -r ddacadba5095 -r 9eaaca2b8a57 src/alice/test/codesegment/local/bitonicsort/Sort.java --- a/src/alice/test/codesegment/local/bitonicsort/Sort.java Thu Mar 28 21:32:21 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/Sort.java Thu Mar 28 21:36:28 2013 +0900 @@ -3,10 +3,12 @@ public class Sort { // this method has "stack overflow" problem - public static void quickSort(DataList data, int begin,int end){ + public static void quickSort(DataList data){ int[] stack = new int[8192]; int sp = 0; int p = 0; + int begin = 0; + int end = data.table.length-1; // index is up to length-1 while(true){ while(begin < end){ if (end-begin< 150){ diff -r ddacadba5095 -r 9eaaca2b8a57 src/alice/test/codesegment/local/bitonicsort/SortTest.java --- a/src/alice/test/codesegment/local/bitonicsort/SortTest.java Thu Mar 28 21:32:21 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SortTest.java Thu Mar 28 21:36:28 2013 +0900 @@ -32,12 +32,12 @@ // quickSort t = System.currentTimeMillis(); - Sort.quickSort(list1,0,list1.table.length-1); + Sort.quickSort(list1); System.out.println("quick sort1 : "+ (System.currentTimeMillis()-t)+" ms"); Sort.check(list1); t = System.currentTimeMillis(); - Sort.quickSort(list2,0,list2.table.length-1); + Sort.quickSort(list2); System.out.println("quick sort2 : "+ (System.currentTimeMillis()-t)+" ms"); Sort.check(list2);