第14周專案1 3 驗證演算法 氣泡排序

2021-08-13 03:19:53 字數 997 閱讀 4754

/*  

* 檔名稱:cpp1.

* 作 者:薛瑞琪

* 完成日期:2017 年 12 月 7 日

* 版 本 號:v1.0

* * 問題描述: 用序列作為測試資料,

* 輸入描述:無需輸入

* 程式輸出:實現各種演算法的函式的測試結果

*/

#include #define maxsize 20

typedef int keytype; //定義關鍵字型別

typedef char infotype[10];

typedef struct //記錄型別

rectype; //排序的記錄型別定義

void bubblesort1(rectype r,int n)

printf("i=%d: ",i);

for (k=0; k

printf("%d ",r[k].key);

printf("\n");

if (exchange==0) //中途結束演算法

return;

}}int main()

; for (i=0; i

r[i].key=a[i];

printf("排序前:");

for (i=0; i

printf("%d ",r[i].key);

printf("\n");

bubblesort1(r,n);

printf("排序後:");

第15周專案1(3) 驗證氣泡排序演算法

1.氣泡排序 include define maxsize 20 typedef int keytype 定義關鍵字型別 typedef char infotype 10 typedef struct 記錄型別 rectype 排序的記錄型別定義 void bubblesort rectype r,...

第14周 專案1 1 驗證演算法

輸入描述 1.折半查詢 include define maxl 100 typedef int keytype typedef char infotype 10 typedef struct nodetype typedef nodetype seqlist maxl 順序表型別 int binse...

第14周專案1 驗證演算法

問題及 檔名稱 lulu.cpp 完成日期 2015年11月30日 版本號 v1.o 作為測試序列,分別對查詢90 47 100進行測試。include define maxl 100 typedef int keytype typedef char infotype 10 typedef stru...