Sort2 [JAVA] 정렬 알고리즘(sorting algorithm) - 달팽이 정렬 만들기(Snail Sort) Snail Sort 달팽이 정렬이 뭐지??????? 그림으로 원리를 알아보자. 아주 쉽져잉 >> 소스보기 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647public class Snail { public static void main(String[] args) { draw(3); draw(6); draw(9); } private static void draw(int size) { int input = size; int i, j, m, n; int cnt = 1; int right = 0, bottom = -1, top = 1; int[][] snailArr = new int[size][size]; fo.. 2014. 7. 20. [JAVA] 정렬 알고리즘(sorting algorithm) - 버블정렬 (Bubble Sort) Bubble Sort 먼저, 버블 정렬의 원리를 보도록 하자. 위와 같이'4, 2, 8, 11, 7' 5개의 원소를 버블 정렬로 정렬시키는데 한번에 4번씩 비교하고 2회전을 걸쳐 완성되었다. 총 8번의 비교를 하였다. >> 소스보기 '4, 54, 2, 8, 63, 7, 55, 56' 8개의 원소로 버블정렬을 이용하여 정렬시키기. 1234567891011121314151617181920212223242526272829303132333435public class BubbleSort { public static void main(String[] args) { int[] data = { 4, 54, 2, 8, 63, 7, 55, 56 }; int temp; int cnt = 0; System.out.print(.. 2014. 7. 20. 이전 1 다음