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

正文內(nèi)容

遞歸的概念遞歸過程與遞歸工作棧遞歸與回溯廣義表(參考版)

2025-07-24 13:45本頁面
  

【正文】 delete q。 //到第一個結(jié)點 if ( qutype == 3 ) //遞歸刪除子表 Remove ( q )。 //引用計數(shù)減 1 if ( ls == 0 ) { //如果減到 0 GenListNode *p = ls, *q。 //在后續(xù)鏈表中刪除 } } } GenList :: ~GenList ( ) { //析構(gòu)函數(shù) Remove ( first )。 //指向同一層后繼結(jié)點 } if ( p != NULL ) { if ( putype == 3 ) //在子表中刪除 delvalue ( p, x )。 delete p。amp。amp。amp。 void delvalue(GenListNode * ls, const value x) { //在廣義表中刪除所有含 x 的結(jié)點 if ( lstlink != NULL ) { //非空表 GenListNode * p = lstlink。 ? 若結(jié)點數(shù)據(jù)不為‘ x’,不執(zhí)行刪除。 } 廣義表的刪除算法 0 1 1 5 3 3 1 2 ? 0 1 2 ‘x’ ? 0 1 0 1 2 ‘y’ ls 3 2 ‘x’ ? ? ?掃描子鏈表 ? 若結(jié)點數(shù)據(jù)為‘ x’, 刪除。 } return m+1。 if ( m n ) m = n。 int m = 0。 } ? ? ? 求廣義表的深度 例如,對于廣義表 E (B (a, b), D (B (a, b), C (u, (x, y, z)), A ( ) ) ) 1 1 1 1 2 3 4 int GenList :: depth ( GenListNode *ls ) { if ( lstlink == NULL ) return 1。 } qtlink = Copy (lstlink)。 break。 break。 break。 if ( ls != NULL ) { q = new GenListNode ( lsutype, NULL )。 ls ) { first = Copy ( )。 else return elemtlink。 else return firsttlink。 return * temp。 else { //非空表 GenList * temp。 //返回類型及值 } } GenListamp。 tempvalue = fristtlinkvalue。 else { //非空表 Items * temp = new Items。 GenList :: Head ( ) { //若廣義表非空 , 則返回其第一個元素的值 , //否則函數(shù)沒有定義 。 firsttlink = NULL。 firstutype = 0。 value = xvalue。 GenListNode :: setInfo ( Items amp。 return * pitem。 pitemutype = elemutype。 //從廣義表的字符串描述 s 出發(fā) , //建立一個帶表頭結(jié)點的廣義表結(jié)構(gòu) } 廣義表的訪問算法 廣義表結(jié)點類的存取成員函數(shù) Itemsamp。 //廣義表的復(fù)制 int depth ( )。 //將 elem2插到表中元素 elem1后 void Copy ( const GenList amp。 //返回第一個元素 GenListNode * Next ( GenListNode *elem )。 Tail ( )。 Head ( )。 //構(gòu)造函數(shù) ~GenList ( )。 //比較以 s和 t為表頭的兩個表是否相等 void Remove (GenListNode *ls )。 //復(fù)制一個 ls 指示的無共享非遞歸表 int depth ( GenListNode *ls )。 class GenList { //廣義表類定義 private: GenListNode *first。x )。 } //返回表元素 elem的數(shù)據(jù)類型 GenListNodeamp。 Info ( GenListNode *elem )。 //utype =3, 存放指向子表的指針 } value。 //utype=1, 存放整數(shù)值 char charinfo。 //下一結(jié)點指針 union { //聯(lián)合 int ref。 private: int utype。 //utype =2, 存放字符 GenListNode *hlink。 //utype=0, 存放引用計數(shù) int intinfo。 int utype。 //GenList類的前視聲明 class GenListNode { //廣義表結(jié)點類的前視聲明 struct Items { //僅有結(jié)點信息的項 friend class G
點擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1