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

正文內(nèi)容

數(shù)據(jù)結(jié)構(gòu)及算法實(shí)驗(yàn)指導(dǎo)書-在線瀏覽

2024-08-05 07:19本頁面
  

【正文】 list b。 =10。 for(i=0。i++) { printf([%d]=,i)。[i])。b)。i。}//時(shí)間復(fù)雜度為T(n)=O(n)。實(shí)驗(yàn)二 鏈表的實(shí)現(xiàn)和應(yīng)用一、實(shí)驗(yàn)?zāi)康?掌握鏈表的定義; 掌握鏈表的基本操作,如查找、插入、刪除、排序等。編輯主函數(shù)驗(yàn)證之。 struct aa *next。NODE *Creatlink(int n, int m){ int i。 //tou 頭結(jié)點(diǎn) tou=(NODE*)malloc(sizeof(NODE))。toudata=n。 for(i=0。i++) //頭插法 { p=(NODE*)malloc(sizeof(NODE))。pdata)。 exit(0)。 tounext=p。}outlink(NODE *h){ NODE *p。 printf(\n\nTHE LIST :\n\n HEAD )。 p=pnext。}main(){ NODE *head。 outlink(head)。 struct list *next。SLIST *creatlist(char *)。int fun( SLIST *h, char ch){ int i。 p=hnext。iN。 p=pnext。}main(){ SLIST *head。 char ch。m39。p39。g39。a39。w39。x39。r39。d39。 head=creatlist(a)。 printf(Enter a letter:)。ch)。 if (k==0) printf(\nNot found!\n)。}SLIST *creatlist(char *a){ int i。 tou=(SLIST*)malloc(sizeof(SLIST))。 tounext=NULL。iN。 pdata=a[i]。 tounext=p。}void outlist(SLIST *h){ SLIST *p。 if (p==NULL) printf(\nThe list is NULL!\n)。 do { printf(%c,pdata)。 } while(p!=NULL)。 }}//去偶操作,鏈表中各節(jié)點(diǎn)按數(shù)據(jù)域遞增有序鏈接,函數(shù)fun的功能是,刪除鏈表中數(shù)據(jù)域值相同的節(jié)點(diǎn),使之只保留一個(gè)include include define N 8typedef struct list{ int data。} SLIST。 //用于遍歷的指針p,用于刪除的指針shanchu p=hnext。 pnext=shanchunext。 } else p=pnext。 int i。 for(i=0。 i++) { q=(SLIST *)malloc(sizeof(SLIST))。 pnext=q。 } pnext=0。}void outlist(SLIST *h){ SLIST *p。 if (p==NULL) printf(\nThe list is NULL!\n)。 do { printf(%d,pdata)。 } while(p!=NULL)。 }}main( ){ SLIST *head。 head=creatlist(a)。 outlist(head)。 printf(\nThe list after deleting :\n)。}//在main函數(shù)中多次調(diào)用fun函數(shù),每調(diào)用一次fun函數(shù),輸出鏈表尾部節(jié)點(diǎn)中的數(shù)據(jù),并釋放該節(jié)點(diǎn),使得鏈表縮短。 struct list *next。void fun( SLIST *p){ SLIST *bianli,*shanchu。 while(bianlinextnext!=NULL) { bianli=bianlinext。 //輸出 shanchu=bianlinext。 bianlinext=NULL。 int i。 for(i=0。 i++) { q=(SLIST *)malloc(sizeof(SLIST))。 pnext=q。 } pnext=0。}void outlist(SLIST *h){ SLIST *p。 if (p==NULL) printf(\nThe list is NULL!\n)。 do { printf(%d,pdata)。 } while(p!=NULL)。 }}main(){ SLIST *head。 head=creatlist(a)。 outlist(head)。 while (headnext != NULL){ fun(head)。 printf(\nOutput from head again :\n)。 }}實(shí)現(xiàn)約瑟夫環(huán)函數(shù)(選做)include include typedef struct list{ int data。} SLIST。 SLIST *tou,*p,*wei。 //頭節(jié)點(diǎn) wei=tou。 for(i=0。i++) //尾插法 { p=(SLIST*)malloc(sizeof(SLIST))。pdata)。 wei=p。 //令最后一個(gè)原素指向首元結(jié)點(diǎn)成環(huán) return tou。 SLIST *p,*shanchu。 //p指向首元結(jié)點(diǎn) while(p!=pnext) //當(dāng)環(huán)中只剩下一個(gè)原素時(shí)結(jié)束 { for(i=1。i++) //根據(jù)輸入的c剔除節(jié)點(diǎn) { p=pnext。 //shanchu指向當(dāng)前要剔除的節(jié)點(diǎn) printf(%d ,shanchudata)。 //將shanchu指針指向的節(jié)點(diǎn)出環(huán) free(shanchu)。 } printf(%d,pdata)。 free(h)。 int m,c。 scanf(%d,%d,amp。c)。 outlist(head,m,c)。實(shí)驗(yàn)三 棧的實(shí)現(xiàn)和應(yīng)用一、實(shí)驗(yàn)?zāi)康?掌握棧的建立方法; 掌握棧的基本操作,如入棧、出棧、判斷空棧等; 棧的應(yīng)用。 int data[STACK_MAX]。void init(stack *st) /*初始化順序棧*/{ sttop=0。 //空0 else return 1。}void push(stack *st,int data) /*入棧*/{ stdata[sttop++]=data。 init(amp。 push(amp。 push(amp。
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1