天空是藍(lán)色的

          做好軟件為中國 #gcc -c helloworld.c -o helloworld.o //編譯目標(biāo)文件 #gcc helloworld.o -o helloworld //編譯成可執(zhí)行exe #helloworld //運(yùn)行exe

          公告


           

          常用鏈接

          留言簿(9)

          隨筆分類(149)

          隨筆檔案(151)

          文章分類(31)

          文章檔案(31)

          C編譯器

          leemay`s

          朋友的blog

          相冊(cè)

          計(jì)算機(jī)原理

          鏈接

          搜索

          •  

          積分與排名

          • 積分 - 449406
          • 排名 - 121

          最新隨筆

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          [轉(zhuǎn)載]快速排序
          快速排序 
           
          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 閱讀(499) 評(píng)論(0)  編輯  收藏 所屬分類: 記事本

          主站蜘蛛池模板: 福鼎市| 乌什县| 繁峙县| 景洪市| 丰台区| 如皋市| 青川县| 徐州市| 措勤县| 宁武县| 湘阴县| 吴堡县| 财经| 柏乡县| 丰镇市| 南充市| 龙州县| 广东省| 云梦县| 监利县| 淅川县| 天等县| 宜黄县| 阿巴嘎旗| 莱州市| 青浦区| 星座| 驻马店市| 新绛县| 吉首市| 云浮市| 玉屏| 宝丰县| 东港市| 巴东县| 和龙市| 砚山县| 唐海县| 桦川县| 塔河县| 泸州市|