Mercurial > hg > Members > tatsuki > Alice
changeset 228:9eaaca2b8a57
change sort method
author | sugi |
---|---|
date | Thu, 28 Mar 2013 21:36:28 +0900 |
parents | ddacadba5095 |
children | 4ece0dca75e7 |
files | src/alice/test/codesegment/local/bitonicsort/Sort.java src/alice/test/codesegment/local/bitonicsort/SortTest.java |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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){
--- 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);