bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

單鏈表的折半查找,冒泡排序,選擇排序-創(chuàng)新互聯(lián)

//選擇排序

創(chuàng)新互聯(lián)10多年成都定制網(wǎng)頁設計服務;為您提供網(wǎng)站建設,網(wǎng)站制作,網(wǎng)頁設計及高端網(wǎng)站定制服務,成都定制網(wǎng)頁設計及推廣,對不銹鋼雕塑等多個行業(yè)擁有多年的網(wǎng)站推廣經(jīng)驗的網(wǎng)站建設公司。

void SelectSort(SeqList* pSeqList)

{

                int i = 0, j = 0;

                int iMaxPos = 0;

                int iMinPos = 0;

                DataType temp;

for (; i < pSeqList->Size/2; ++i)

  {

     iMaxPos = i;

     iMinPos = i;

    for(j = 1; j < pSeqList->Size - i; j++)

      {

      if (pSeqList->arry[iMaxPos] < pSeqList->arry[j])

           {

                 iMaxPos = j;

           }

      if (pSeqList->arry[iMinPos] > pSeqList->arry[j])

           {

               iMinPos = j;

            }

      }

    if (iMaxPos != i)

     {

          temp = pSeqList->arry[iMaxPos];

        pSeqList->arry[iMaxPos] = pSeqList->arry[pSeqList->Size - i - 1];

        pSeqList->arry[pSeqList->Size - i - 1] = temp;

      }

     if (iMinPos != i)

     {

         temp = pSeqList->arry[iMinPos];

          pSeqList->arry[iMinPos] = pSeqList->arry[i];

          pSeqList->arry[i] = temp;

      }

  }

}

//冒泡排序

void BorbbleSort(SeqList* pSeqList)

{

                int iCount = 0;

                int iBegin = 0;

                int iFlag = 0;

                if (NULL == pSeqList)

                {

                                return;

                }

    for (; iCount <pSeqList->Size - 1; iCount++)

    {

        iFlag = 1;

        for (iBegin = 0; iBegin < pSeqList->Size - iCount - 1; ++iBegin)

        {

          if (pSeqList->arry[iBegin] > pSeqList->arry[iBegin+1])

           {

                DataType temp = pSeqList->arry[iBegin];

                pSeqList->arry[iBegin] = pSeqList->arry[iBegin+1];

                pSeqList->arry[iBegin+1] = temp;

                 iFlag = 0;

            }

          }

          if (iFlag)

          {

             return;

          }

     }

}

// 折半查找

int BinarySearch(SeqList* pSeqList, DataType data)

{

                int iLeft = 0;

                int iRight = pSeqList->Size;// [)

                //int iMid = (iLeft + iRight)/2;

                int iMid = 0;

                DataType temp;

                if (NULL == pSeqList)

                {

                                return;

                }

                // [0, 4]

                while(iLeft < iRight)

                {

                                iMid = iLeft + (iRight - iLeft)/2;

                                temp = pSeqList->arry[iMid];

                                if (temp < data)

                                {

                                                iLeft = iMid;

                                }

                                else if (temp > data)

                                {

                                                iRight = iMid - 1;

                                }

                                else

                                {

                                                return iMid;

                                }

                }

                return -1;

}

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

網(wǎng)頁題目:單鏈表的折半查找,冒泡排序,選擇排序-創(chuàng)新互聯(lián)
鏈接URL:http://vcdvsql.cn/article2/epooc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站維護虛擬主機網(wǎng)站制作ChatGPT全網(wǎng)營銷推廣用戶體驗

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化