2011-05-02 5 views

답변

5

당신은 아무것도 호출하지 않습니다.

패키지는 java.util에 비공개 인 정렬 방법이 있습니다. Arrays.sort() 함수 또는 이와 비슷한 함수를 호출 할 때 호출하도록합니다. SortTest.java -

  • http://pastebin.com/VNyUutiD을 :

    는 주석에 의해 분명하게됩니다 :

    /* 
    * The next two methods (which are package private and static) constitute 
    * the entire API of this class. Each of these methods obeys the contract 
    * of the public method with the same signature in java.util.Arrays. 
    */ 
    
    static <T> void sort(T[] a, Comparator<? super T> c) { 
        sort(a, 0, a.length, c); 
    } 
    
    static <T> void sort(T[] a, int lo, int hi, Comparator<? super T> c) { 
        ... 
    } 
    

    내 마지막 코멘트의 시간으로 판단,이 어떻게 15 분 미만했다

  • http://pastebin.com/deGAfWZj - TimSort.java

전자 결과 :

C:\Documents and Settings\glowcoder\My Documents>java SortTest 
Time for default: 4094ms 
Time for timsort: 3813ms 

C:\Documents and Settings\glowcoder\My Documents> 
+0

+1 너는 나를 다시 – MByD

+0

잡았다. Java로 Tim Sort의 "완전한"소스를 아십니까? 우리가 Java 7에 있지 않기 때문에 아직 메소드를 호출 할 수 없다고 생각합니다. = x 감사합니다. – Seva

+1

@Seva TimSort에 전화해야 할 필요가 있습니까? 그리고 복사/붙여 넣기에서 당신을 막는 방법과 두 가지'public' 방법과 패키지를 변경하는 방법이 있습니까? – corsiKa

관련 문제