天空是藍色的

          做好軟件為中國 #gcc -c helloworld.c -o helloworld.o //編譯目標文件 #gcc helloworld.o -o helloworld //編譯成可執行exe #helloworld //運行exe

          公告


           

          常用鏈接

          留言簿(9)

          隨筆分類(149)

          隨筆檔案(151)

          文章分類(31)

          文章檔案(31)

          C編譯器

          leemay`s

          朋友的blog

          相冊

          計算機原理

          鏈接

          搜索

          •  

          積分與排名

          • 積分 - 450203
          • 排名 - 121

          最新隨筆

          最新評論

          閱讀排行榜

          評論排行榜

          [轉載]快速排序
          快速排序 
           
          class Test {
           
           public static void quickSort( int
          [] intArr, int startIndex, int endIndex ) {
            int left 
          = startIndex;
            int right = endIndex;
            int pivot = (left+right)/2;
            int tmp = 0;
            
            do {
             while( intArr
          [left]<intArr[pivot] )  left++;
             while( intArr[right] > intArr[pivot] ) right--;
             
             if( left<
          =right ) {
              tmp 
          = intArr[left];
              intArr[left] = intArr[right];
              intArr[right] = tmp;
              left++;
              right--;
             }
            }while(left<
          =right);
            
            if( left<endIndex ) quickSort( intArr
          , left, endIndex );
            if( right>startIndex ) quickSort( intArr, startIndex, right);
           }
                
           public static void main( String
          [] argus ) {
            int
          [] test = new int[]{5,4,3,2,1};
            quickSort( test, 0 , test.length-1 );
            for ( int i=0; i<test.length; i++ )  System.out.print( "test["+i+"]="+test[i]+"    " );
           }

          http://spaces.msn.com/members/zhangqingqi/

          posted on 2005-12-31 10:30 bluesky 閱讀(502) 評論(0)  編輯  收藏 所屬分類: 記事本

          主站蜘蛛池模板: 高淳县| 汝阳县| 洛浦县| 应城市| 尉氏县| 逊克县| 织金县| 衡南县| 宁都县| 抚州市| 潍坊市| 洪江市| 林芝县| 花莲市| 西乌珠穆沁旗| 梅河口市| 北碚区| 浏阳市| 嘉善县| 淮安市| 绩溪县| 南投县| 塔城市| 安顺市| 洪泽县| 祥云县| 广丰县| 韩城市| 云霄县| 大荔县| 抚顺县| 冕宁县| 财经| 诸暨市| 永川市| 兴义市| 旬邑县| 融水| 泊头市| 临猗县| 盘锦市|