0
선택 정렬을 실행하여 작동 방식을 확인하려고합니다. 예상대로 코드가 작동하지 않습니다. 누군가 내가 잘못한 것을 지적 할 수 있습니까? 부품을 교환 할 때 문제가 있다는 것을 알고 있지만 이유는 확실하지 않습니다.왜 내 선택 정렬이 전혀 정렬되지 않습니까?
import java.util.*;
public class Driver
{
private static int length = 10;
private static int[] arr = new int [length];
public static void main(String [] args)
{
Random rand = new Random();
//seed the array
for(int counter = 0; counter < length ;counter++)
{
arr[counter] = rand.nextInt(10);
}
SortingAlgorithm tool = new SortingAlgorithm();
arr = tool.selection(arr, length);
for(int i = 0; i < length ;i++)
{
System.out.println(arr[i]);
}
System.out.println(tool.getTimeRun());
}
} 당신이 스왑을 호출 할 때
나는 방금 벙어리의 새로운 수준에 도달했다고 생각합니다 ... 감사합니다 CDahn – Rozen