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

正文內(nèi)容

[工學(xué)]數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)(編輯修改稿)

2025-02-12 06:26 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 ntf(\nThere is a x in the tree.)。return t。}/*查找算法*/if(x=pdata){q=p。 p=plson。}else {q=p。p=prson。}}if(p==NULL) insert(t,x)。/*循環(huán)結(jié)束查找成功,調(diào)用插入算將x插入合適的位置*/traverse(t)。}(二)Josephu問題的實(shí)現(xiàn)1,循環(huán)鏈表類型typedef struct node{int data。struct node *next。}lnode,*linklist。2,創(chuàng)建循環(huán)鏈表算法linklist creatlist(int n){p=(lnode*)malloc(sizeof(lnode))。if(p==NULL) return(0)。//若空間分配失敗,返回0head=p。pdata=1。pnext=NULL。for(i=2。i=n。i++)//為n個(gè)結(jié)點(diǎn)賦值編號(hào){pnext=(lnode*)malloc(sizeof(lnode))。if(pnext==NULL) return(0)。pnextdata=i。p=pnext。}pnext=head。//令最后一個(gè)結(jié)點(diǎn)的next指針指向頭結(jié)點(diǎn),實(shí)現(xiàn)循環(huán)鏈表return(head)。}3,約瑟夫問題的求解算法void delete(linklist head,int k,int m){linklist p=head,s=head,q。//s為指向p的前一個(gè)結(jié)點(diǎn)的指針int j=0,i=1。while(pdatak)//找到編號(hào)為k的結(jié)點(diǎn),p指向這個(gè)結(jié)點(diǎn){ s=p。 p=pnext。}while(p!=pnext)//若不是只剩下一個(gè)結(jié)點(diǎn){while(im)//找到從k開始第m個(gè)結(jié)點(diǎn){p=pnext。s=snext。i++。}q=pnext。 printf(%d ,pdata)。j++。if(j%10==0) printf(\n)。//每輸出十個(gè)數(shù),另起一行snext=q。//刪除結(jié)點(diǎn)pfree(p)。p=q。//p指向刪除結(jié)點(diǎn)的下一個(gè)結(jié)點(diǎn)i=1。}printf(%d ,pdata)。//只剩下一個(gè)結(jié)點(diǎn)的時(shí)候,直接輸出該節(jié)點(diǎn),結(jié)束此函數(shù)}(三)迷宮問題求解1,坐標(biāo)位置類型typedef struct{int row。int col。}postype。typedef struct{int arr[100][100]。}mazetype。3,棧類型typedef struct{postype seat。int di。}stype。typedef struct{stype s[100]。int top。}sqstack。4,棧的相關(guān)操作void push(sqstack *p, stype e)//壓棧操作{if(ptop==100) printf(The stack is overflow!);else{ptop++。ps[ptop]=e。}}stype pop(sqstack *s)//出棧操作,返回刪除的元素{if(stop==1) printf(The stack is empty!)。else{stop。return ss[stop+1]。}}int stackempty(sqstack *s)//判??詹僮?,??辗祷?,否則返回0{if(stop==1) return 1。else return 0。}5,迷宮相關(guān)算法void initmaze(mazetype *maze, int row, int col)//迷宮的初始化{int i,j,a。for(i=0。i=row+1。i++){mazearr[i][0]=1。mazearr[i][col+1]=1。}for(i=0。i=col+1。i++){mazearr[0][i]=1。mazearr[row+1][i]=1。}//將迷宮四周值設(shè)為1,作為圍墻,不可通for(i=1。i=row。i++){for(j=1。j=col。j++){scanf(%d,amp。a)。mazearr[i][j]=a。//用戶輸入迷宮形狀}}}void printmaze(mazetype *m,int row,int col)//打印迷宮形狀{ int i,j,count=0。for(i=0。i=row+1。i++){for(j=0。j=col+1。j++){printf(%d,marr[i][j])。count++。if(count==row+2) //{count=0。printf(\n)。} }}}int mazepath(mazetype *maze,postype start, postype end){//求解迷宮maze中,從入口start到出口end的一條路徑//若存在,返回1,否則返回0sqstack s,s1。stype e,e2,e3。postype c=start。 =1。=1。do{ if(mazearr[][]==0) //如果當(dāng)前位置可以通過,即是未曾走到的通道塊{ mazearr[][]=3。 //留下足
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1