中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

用哪個(gè)程序做網(wǎng)站收錄好6dw網(wǎng)站制作

用哪個(gè)程序做網(wǎng)站收錄好6,dw網(wǎng)站制作,深圳建設(shè)網(wǎng)站公司,wordpress封裝易語(yǔ)言1 煎餅排序問題 給定一個(gè)未排序的數(shù)組,任務(wù)是對(duì)給定數(shù)組進(jìn)行排序。您只能在陣列上執(zhí)行以下操作。 翻轉(zhuǎn)(arr,i):將數(shù)組從0反轉(zhuǎn)為i 示例: 輸入:arr[]{23、10、20、11、12、6、7} 輸出&#xff1a…

1?煎餅排序問題

給定一個(gè)未排序的數(shù)組,任務(wù)是對(duì)給定數(shù)組進(jìn)行排序。您只能在陣列上執(zhí)行以下操作。
翻轉(zhuǎn)(arr,i):將數(shù)組從0反轉(zhuǎn)為i
示例:
輸入:arr[]={23、10、20、11、12、6、7}
輸出:{6、7、10、11、12、20、23}
輸入:arr[]={0,1,1,0,0}
輸出:{0,0,0,1,1}
方法:與傳統(tǒng)排序算法不同,傳統(tǒng)排序算法試圖以盡可能少的比較進(jìn)行排序,其目標(biāo)是以盡可能少的反轉(zhuǎn)對(duì)序列進(jìn)行排序。
這個(gè)想法是做一些類似于選擇排序的事情。我們一個(gè)接一個(gè)地將最大元素放在末尾,并將當(dāng)前數(shù)組的大小減少一個(gè)。
以下是詳細(xì)步驟。設(shè)給定數(shù)組為arr[],數(shù)組大小為n。
對(duì)每個(gè)curr_size執(zhí)行以下操作:
(1)查找arr[0到curr_szie-1]中最大元素的索引。讓索引為“mi”;
(2)翻轉(zhuǎn)(arr,mi);
(3)翻轉(zhuǎn)(arr,curr_size–1);

2 源代碼

using System;
using System.Collections;
using System.Collections.Generic;namespace Legalsoft.Truffer.Algorithm
{public static partial class Algorithm_Gallery{private static int PSP_Ceil_Search(int[] arr, int low, int high, int x){if (x <= arr[low]){return low;}if (x > arr[high]){return -1;}int mid = (low + high) / 2;if (arr[mid] == x){return mid;}if (arr[mid] < x){if (mid + 1 <= high && x <= arr[mid + 1]){return mid + 1;}else{return PSP_Ceil_Search(arr, mid + 1, high, x);}}if (mid - 1 >= low && x > arr[mid - 1]){return mid;}else{return PSP_Ceil_Search(arr, low, mid - 1, x);}}private static void PSP_Flip(ref int[] arr, int i){int temp, start = 0;while (start < i){temp = arr[start];arr[start] = arr[i];arr[i] = temp;start++;i--;}}private static void PSP_Insertion_Sort(ref int[] arr, int size){for (int i = 1; i < size; i++){int j = PSP_Ceil_Search(arr, 0, i - 1, arr[i]);if (j != -1){PSP_Flip(ref arr, j - 1);PSP_Flip(ref arr, i - 1);PSP_Flip(ref arr, i);PSP_Flip(ref arr, j);}}}}
}

第二部分:

using System;
using System.Collections;
using System.Collections.Generic;namespace Legalsoft.Truffer.Algorithm
{public static partial class Algorithm_Gallery{private static int PSP_Find_Maxium(int[] arr, int n){int mi=0;for (int i = 0; i < n; i++){if (arr[i] > arr[mi]){mi = i;}}return mi;}public static void Pancake_Sort(ref int[] arr, int n){for (int curr_size = n; curr_size > 1; curr_size--){int mi = PSP_Find_Maxium(arr, curr_size);if (mi != curr_size - 1){PSP_Flip(ref arr, mi);PSP_Flip(ref arr, curr_size - 1);}}}}
}

3 源程序

using System;
using System.Collections;
using System.Collections.Generic;

namespace Legalsoft.Truffer.Algorithm
{
? ? public static partial class Algorithm_Gallery
? ? {
? ? ? ? private static int PSP_Ceil_Search(int[] arr, int low, int high, int x)
? ? ? ? {
? ? ? ? ? ? if (x <= arr[low])
? ? ? ? ? ? {
? ? ? ? ? ? ? ? return low;
? ? ? ? ? ? }
? ? ? ? ? ? if (x > arr[high])
? ? ? ? ? ? {
? ? ? ? ? ? ? ? return -1;
? ? ? ? ? ? }
? ? ? ? ? ? int mid = (low + high) / 2;

? ? ? ? ? ? if (arr[mid] == x)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? return mid;
? ? ? ? ? ? }
? ? ? ? ? ? if (arr[mid] < x)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (mid + 1 <= high && x <= arr[mid + 1])
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? return mid + 1;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? return PSP_Ceil_Search(arr, mid + 1, high, x);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? if (mid - 1 >= low && x > arr[mid - 1])
? ? ? ? ? ? {
? ? ? ? ? ? ? ? return mid;
? ? ? ? ? ? }
? ? ? ? ? ? else
? ? ? ? ? ? {
? ? ? ? ? ? ? ? return PSP_Ceil_Search(arr, low, mid - 1, x);
? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private static void PSP_Flip(ref int[] arr, int i)
? ? ? ? {
? ? ? ? ? ? int temp, start = 0;
? ? ? ? ? ? while (start < i)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? temp = arr[start];
? ? ? ? ? ? ? ? arr[start] = arr[i];
? ? ? ? ? ? ? ? arr[i] = temp;
? ? ? ? ? ? ? ? start++;
? ? ? ? ? ? ? ? i--;
? ? ? ? ? ? }
? ? ? ? }

? ? ? ? private static void PSP_Insertion_Sort(ref int[] arr, int size)
? ? ? ? {
? ? ? ? ? ? for (int i = 1; i < size; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? int j = PSP_Ceil_Search(arr, 0, i - 1, arr[i]);

? ? ? ? ? ? ? ? if (j != -1)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? PSP_Flip(ref arr, j - 1);
? ? ? ? ? ? ? ? ? ? PSP_Flip(ref arr, i - 1);
? ? ? ? ? ? ? ? ? ? PSP_Flip(ref arr, i);
? ? ? ? ? ? ? ? ? ? PSP_Flip(ref arr, j);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
?

using System;
using System.Collections;
using System.Collections.Generic;

namespace Legalsoft.Truffer.Algorithm
{
?? ?public static partial class Algorithm_Gallery
?? ?{
?? ??? ?private static int PSP_Find_Maxium(int[] arr, int n)
?? ??? ?{
?? ??? ??? ?int mi=0;
?? ??? ??? ?for (int i = 0; i < n; i++)
?? ??? ??? ?{
?? ??? ??? ??? ?if (arr[i] > arr[mi])
?? ??? ??? ??? ?{
?? ??? ??? ??? ??? ?mi = i;
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?return mi;
?? ??? ?}

?? ??? ?public static void Pancake_Sort(ref int[] arr, int n)
?? ??? ?{
?? ??? ??? ?for (int curr_size = n; curr_size > 1; curr_size--)
?? ??? ??? ?{
?? ??? ??? ??? ?int mi = PSP_Find_Maxium(arr, curr_size);
?? ??? ??? ??? ?if (mi != curr_size - 1)
?? ??? ??? ??? ?{
?? ??? ??? ??? ??? ?PSP_Flip(ref arr, mi);
?? ??? ??? ??? ??? ?PSP_Flip(ref arr, curr_size - 1);
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?}
?? ?}
}
?

http://m.risenshineclean.com/news/38148.html

相關(guān)文章:

  • 網(wǎng)站目前如何做外鏈地推掃碼平臺(tái)
  • 代碼編輯器做熱點(diǎn)什么網(wǎng)站好精準(zhǔn)引流推廣公司
  • 建模外包網(wǎng)站推廣怎么做
  • 衡水網(wǎng)站建設(shè)服務(wù)廣告聯(lián)盟有哪些
  • 廣州移動(dòng) 網(wǎng)站建設(shè)今日特大新聞
  • 如何做高校的網(wǎng)站版面設(shè)計(jì)品牌宣傳策略
  • 做網(wǎng)站需要續(xù)費(fèi)嗎深圳seo優(yōu)化外包
  • 德州哪里有做網(wǎng)站推廣的深圳seo優(yōu)化排名優(yōu)化
  • 網(wǎng)站建設(shè)需要精通什么知識(shí)網(wǎng)絡(luò)推廣的優(yōu)勢(shì)有哪些
  • 個(gè)人可以做幾個(gè)網(wǎng)站嗎百度快照是什么意思?
  • 網(wǎng)站開發(fā)與網(wǎng)站建設(shè)精準(zhǔn)獲客
  • 網(wǎng)站 建設(shè)網(wǎng)站市場(chǎng)調(diào)研分析
  • 廈門做網(wǎng)站個(gè)人蘇州做網(wǎng)站的專業(yè)公司
  • 網(wǎng)站建設(shè)需要什么資料智能營(yíng)銷方法
  • 松江新城投資建設(shè)集團(tuán)有限公司網(wǎng)站網(wǎng)絡(luò)營(yíng)銷第三版課本
  • 龍崗做網(wǎng)站的公司源碼之家
  • 網(wǎng)站建設(shè)到運(yùn)營(yíng)需要多少錢怎樣在百度上做廣告
  • 做品牌網(wǎng)站公司淄博網(wǎng)站營(yíng)銷與推廣
  • 臺(tái)州專業(yè)網(wǎng)站設(shè)計(jì)系統(tǒng)網(wǎng)絡(luò)推廣有哪幾種方法
  • 做網(wǎng)站品牌怎么注冊(cè)自己公司的網(wǎng)址
  • 舟山市城鄉(xiāng)建設(shè)委員會(huì)網(wǎng)站seo搜索引擎優(yōu)化是通過優(yōu)化答案
  • 什么網(wǎng)站可以做自考試題seo教育
  • 品牌網(wǎng)站建設(shè)多少錢品牌推廣策略分析
  • 網(wǎng)站怎樣才有流量seo是指搜索引擎營(yíng)銷
  • 深圳設(shè)計(jì)裝修公司哪家好百度關(guān)鍵詞優(yōu)化培訓(xùn)
  • 合肥最好的網(wǎng)站建設(shè)公司化妝培訓(xùn)
  • 上海松江做網(wǎng)站多少錢怎么做百度推廣平臺(tái)
  • 網(wǎng)站開發(fā)流程百度文庫(kù)北京關(guān)鍵詞優(yōu)化報(bào)價(jià)
  • 天津網(wǎng)站建設(shè)價(jià)格培訓(xùn)課程安排
  • 小縣城做網(wǎng)站百度推廣平臺(tái)收費(fèi)標(biāo)準(zhǔn)