package algorithm.sort.insertion;
import algorithm.sort.Sort;
import algorithm.sort.bubble.BubbleSort;
public class Main {
public static void main(String[] arguments) {
int[] a = {2,1,3,5,8,4};
int[] b;
Sort sort = new InsertionSort(a);
b = sort.getSort();
for (int temp : b) {
System.out.print(temp + " ");
}
System.out.println(" insertionSort swap times: " + sort.getSwapTimes());
System.out.println(" insertionSort search times: " + sort.getSearchTimes());
////////
sort = new BubbleSort(a);
b = sort.getSort();
for (int temp : b) {
System.out.print(temp + " ");
}
System.out.println(" bubbleSort swap times: " + sort.getSwapTimes());
System.out.println(" bubbleSort search times: " + sort.getSearchTimes());
}
}
'ALGORITHM' 카테고리의 다른 글
SEARCH ABSTRACT CLASS & NODE CLASS (0) | 2011.04.18 |
---|---|
QUICK SORT (0) | 2011.04.16 |
INSERTION SORT (0) | 2011.04.14 |
정렬 관련 추상클래스 만들어보기. (0) | 2011.04.14 |
BUBBLE SORT (0) | 2011.04.14 |