freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

數(shù)據(jù)結(jié)構(gòu)實(shí)驗(yàn)指導(dǎo)書(shū)重要參考-資料下載頁(yè)

2025-08-04 16:40本頁(yè)面
  

【正文】 LGraph。 /*建立圖的鄰接表*/ void creat_link(ALGraph *G) {int i,j。 ArcNode *s。 printf(輸入頂點(diǎn)數(shù)、邊數(shù):)。 scanf(%d%d,amp。Gvexnum,amp。Garum)。 for (i=0。iGvexnum。i++) {Gvertices[i].data=39。A39。+i。 Gvertices[i].firstarc=NULL。 } printf(Input the adjvexs of arcs\n)。 for (i=0。iGarum。i++) {scanf(%d%d,amp。i,amp。j)。 s=(ArcNode *)malloc(sizeof(ArcNode))。 sadjvex=j。 snextarc=Gvertices[i].firstarc。 Gvertices[i].firstarc=s。 } } /*輸出鄰接表 */ void visit(ALGraph G) {int i。 ArcNode *p。 printf(%4s%6s%18s\n,NO,data,adjvexs of arcs)。 for (i=0。i。i++) {printf(%4d%5c ,i,[i].data)。 for(p=[i].firstarc。p。p=pnextarc) printf(%3d,padjvex)。 printf(\n)。 } } /*計(jì)算各頂點(diǎn)的度及入度*/ void cacu(ALGraph *G) {ArcNode *p。 int i。 for (i=0。iGvexnum。i++) {Gvertices[i].degree=0。Gvertices[i].indegree=0。} for (i=0。iGvexnum。i++) for(p=Gvertices[i].firstarc。p。p=pnextarc) {Gvertices[i].degree++。 Gvertices[padjvex].degree++。 Gvertices[padjvex].indegree++。 } } void print_degree(ALGraph G) {int i。 printf(\n No data deg ind\n)。 for (i=0。i。i++)printf(\n%4d%4c%4d%4d,i,[i].data,[i].degree,[i].indegree)。 } /*拓?fù)渑判?/ Status TopologiSort(ALGraph G) {int i,k,count,top=0,stack[50]。 ArcNode *p。 cacu(amp。G)。 print_degree(G)。 printf(\nTopologiSort is \n)。 for(i=0。i。i++) if(![i].indegree) stack[top++]=i。 count=0。 while(top!=0) {i=stack[top]。 if (count==0) printf(%c,[i].data)。 else printf(%c,[i].data)。 count++。 for(p=[i].firstarc。p。p=pnextarc) if (![padjvex].indegree)stack[top++]=padjvex。 } if (count)return(FALSE)。 else return(TRUE)。 }/*圖的主函數(shù)部分,*/ main() {ALGraph G。 creat_link(amp。G)。 visit(G)。 if(!TopologiSort(G))printf(Toposort is not success!)。 }/**/include define n 9define KeyType int typedef struct {KeyType key。 }ElemType。 typedef struct node {ElemType elem。 struct node *next。 }NODE。 typedef NODE *HashTable[n]。 int Hash(KeyType key)/*哈希函數(shù)*/ {int i。 i=key %n。 return i。 } /*動(dòng)態(tài)查找哈希表*/ void search(HashTable H,KeyType k) {int i。 NODE *p,*s。 i=Hash(k)。 p=H[i]。 while(pamp。amp。p!=k)p=pnext。 if (!p){/*表中無(wú)元素k則將其插入*/ s=(NODE *)malloc(sizeof(NODE))。 s=k。 snext=H[i]。 H[i]=s。 } else printf(Found %d, k)。 } void create(HashTable H)/*哈希表建立*/ {int i。 KeyType k。 for (i=0。in。i++) H[i]=NULL。 printf(Create HashTable,input keys(End of 0)\n)。 scanf(%d,amp。k)。 while (k) {search(H,k)。 scanf(%d,amp。k)。 } } main() {HashTable H。 int i。NODE *p。 clrscr()。 create(H)。 for (i=0。in。i++) {printf(\nThe keys of that hash_address is %d are ,i)。 for(p=H[i]。p。p=pnext) printf(%3d,p)。 } }_ /*排序頭文件部分,*/ include include define MAXSIZE 20 typedef int KeyType。 typedef struct {KeyType key。 char other。 }RedType。 typedef struct {RedType r[MAXSIZE+1]。 int length。 }SqList。 /*輸入排序元素的初始序列*/ void create(SqList *L) {int i。 randomize()。 Llength=random(MAXSIZE)。 for(i=1。i=Llength。i++) { Lr[i].key=random(100)。 Lr[i].other=random(26)+65。} } /*輸出元素*/ void visit(SqList L) {int i,k。 printf(\n)。 for(i=1。i=。i++) printf(%4d%2c,[i].key,[i].other)。 printf(\n)。 } /*簡(jiǎn)單選擇排序*/ void select_sort(SqList *L) { int i,j,k。 RedType t。 for (i=1。iLlength。i++) {j=i。 for (k=i+1。k=Llength。k++) if (Lr[j].keyLr[k].key) j=k。 if (i!=j) {t=Lr[j]。Lr[j]=Lr[i]。Lr[i]=t。 } } } /*快速排序*/void QSort(SqList *L,int low,int high) {int i,j。 if (lowhigh) { i=low。j=high。Lr[0]=Lr[i]。 while(ij) { while(ijamp。amp。Lr[j].key=Lr[0].key) j。 Lr[i]=Lr[j]。 while(ijamp。amp。Lr[i].key=Lr[0].key) i++。 Lr[j]=Lr[i]。 } Lr[i]=Lr[0]。 QSort(L,low,i1)。 QSort(L,i+1,high)。 } } void QuickSort(SqList *L) {QSort(L,1,Llength)。 } void pause() {printf(Pause,continue blankspace pressed\n)。 while(getch()!=39。 39。)。 }/*主函數(shù)部分,*/ main() {int select。 SqList L。 do { clrscr()。 printf( 1 select_sort 2 quick_sort 0 exit\n )。 printf( Please input number(02)\n)。 scanf(%d,amp。select)。 switch (select) {case 0:exit(0)。 case 1:create(amp。L)。 visit(L)。 select_sort(amp。L)。 visit(L)。 break。 case 2:create(amp。L)。 visit(L)。 QuickSort(amp。L)。 visit(L)。 break。 default:printf(ERROR!\n)。 break。 } pause()。 }while(1)。 }36
點(diǎn)擊復(fù)制文檔內(nèi)容
電大資料相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1