版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Software College Northeastern UniversityData StructureSoftware College Northeastern Universityz Reverse a list List:Reverse()if L contains three nodes with data 1, 2, and 3 (read in order from the head of the list to the tail) then the Reverse list that is returned by the function should also contai
2、n three nodes with data 3, 2, and 1 (read in order from the head of the list).Data StructureSoftware College Northeastern UniversitySequence List Solutions Data StructureSoftware College Northeastern UniversitySequence List SolutionsData StructureSoftware College Northeastern UniversitySequence List
3、 SolutionstempData StructureSoftware College Northeastern UniversitySequence List SolutionstempData StructureSoftware College Northeastern UniversityData StructureSoftware College Northeastern UniversitySequence List SolutionsData StructureSoftware College Northeastern UniversityData StructureSoftwa
4、re College Northeastern UniversityTemplate of linked list(1)template class List;template class ListNode friend class List; Type data; /結(jié)點(diǎn)數(shù)據(jù)結(jié)點(diǎn)數(shù)據(jù) ListNode *link; /結(jié)點(diǎn)鏈接指針結(jié)點(diǎn)鏈接指針public: ListNode ( ); /鏈表結(jié)點(diǎn)構(gòu)造函數(shù)鏈表結(jié)點(diǎn)構(gòu)造函數(shù) ListNode ( const Type& item ); ListNode *NextNode ( ) return link; /給出當(dāng)前結(jié)點(diǎn)的下一結(jié)點(diǎn)地址給出當(dāng)前結(jié)點(diǎn)
5、的下一結(jié)點(diǎn)地址Data StructureSoftware College Northeastern Universityvoid InsertAfter ( ListNode *p ); /在當(dāng)前結(jié)點(diǎn)后插入結(jié)點(diǎn)在當(dāng)前結(jié)點(diǎn)后插入結(jié)點(diǎn)p ListNode *RemoveAfter ( ); /摘下當(dāng)前結(jié)點(diǎn)的下一結(jié)點(diǎn)摘下當(dāng)前結(jié)點(diǎn)的下一結(jié)點(diǎn);template class List ListNode *first, *last;public: ListNode *GetNode ( const Type& item, ListNode *next ); /創(chuàng)建數(shù)據(jù)為創(chuàng)建數(shù)據(jù)為item,指針為,指針為n
6、ext的新結(jié)點(diǎn)的新結(jié)點(diǎn)Template of linked list(2)Data StructureSoftware College Northeastern University List ( const Type & value ) last =first = new ListNode( value ); /構(gòu)造函數(shù)構(gòu)造函數(shù) List ( ); /析構(gòu)函數(shù)析構(gòu)函數(shù) void MakeEmpty ( ); /鏈表置空鏈表置空 int Length ( ) const; /求鏈表長(zhǎng)度求鏈表長(zhǎng)度 ListNode *Find ( Type value ); ListNode *Find ( i
7、nt i ); int Insert ( Type value, int i ); Type *Remove ( int i ); Type *Get ( int i ); void Reverse(); Template of linked list(3)Data StructureSoftware College Northeastern UniversityLinked List Solutions 15FirstLastData StructureSoftware College Northeastern UniversityInsert Before the first elemen
8、t 15FirstLastPData StructureSoftware College Northeastern UniversityLinked List Solutions 25FirstLastP1Data StructureSoftware College Northeastern UniversityLinked List Solutions 35FirstP21Data StructureSoftware College Northeastern UniversityLinked List Solutions 45FirstP321Data StructureSoftware College Northeastern UniversityLinked List Solutions 5FirstP4321Data StructureSoftware College Northeastern UniversityLinked List SolutionsFirstNULLP5432Data StructureSoftware College Northeastern Universitytemplate void List:Reverse( ) ListNode
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年中國(guó)Mini LED行業(yè)開(kāi)拓第二增長(zhǎng)曲線(xiàn)戰(zhàn)略制定與實(shí)施研究報(bào)告
- 2025-2030年中國(guó)搬家行業(yè)商業(yè)模式創(chuàng)新戰(zhàn)略制定與實(shí)施研究報(bào)告
- 2025-2030年中國(guó)風(fēng)電設(shè)備行業(yè)商業(yè)模式創(chuàng)新戰(zhàn)略制定與實(shí)施研究報(bào)告
- 2025年網(wǎng)絡(luò)工程師工作計(jì)劃(共5篇)
- 廣東省2024屆高三下學(xué)期三模英語(yǔ)試題
- 高端智能專(zhuān)用車(chē)制造項(xiàng)目環(huán)境影響報(bào)告書(shū)批前
- 年產(chǎn)100萬(wàn)立方建筑用砂巖新建項(xiàng)目資金申請(qǐng)報(bào)告
- 二年級(jí)數(shù)學(xué)計(jì)算題專(zhuān)項(xiàng)練習(xí)1000題匯編集錦
- 2023屆江蘇省蘇州市高三二??记澳M地理卷(一)附答案
- 手工制瓷技藝2
- 口腔修復(fù)學(xué)(全套課件290p)課件
- 小學(xué)生心理問(wèn)題的表現(xiàn)及應(yīng)對(duì)措施【全國(guó)一等獎(jiǎng)】
- 小學(xué)生科普人工智能
- 初中學(xué)段勞動(dòng)任務(wù)清單(七到九年級(jí))
- 退耕還林監(jiān)理規(guī)劃
- GB/T 1335.2-2008服裝號(hào)型女子
- GB 31247-2014電纜及光纜燃燒性能分級(jí)
- DCC20網(wǎng)絡(luò)型監(jiān)視與報(bào)警
- 項(xiàng)目實(shí)施路徑課件
- 《簡(jiǎn)單教數(shù)學(xué)》讀書(shū)心得課件
- 《室速的診斷及治療》課件
評(píng)論
0/150
提交評(píng)論