版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(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)益歸上傳用戶所有。
- 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年企業(yè)安全文化建設(shè)手冊(cè)
- 2025年企業(yè)內(nèi)部保密工作制度實(shí)施指南
- 反餐飲浪費(fèi)管理制度
- 超市員工績(jī)效考核制度
- 超市商品采購(gòu)及談判制度
- 2026年熱帶海洋環(huán)境與島礁生態(tài)全國(guó)重點(diǎn)實(shí)驗(yàn)室科研助理崗位招聘?jìng)淇碱}庫(kù)及完整答案詳解一套
- 養(yǎng)老院老人健康飲食營(yíng)養(yǎng)師管理制度
- 2026年白云區(qū)云城街招聘城中村改造工作人員的備考題庫(kù)附答案詳解
- 2026年英德市國(guó)防教育訓(xùn)練中心面向社會(huì)公開(kāi)招聘1名專職民兵教練員備考題庫(kù)及答案詳解一套
- 興義市人民醫(yī)院2025年公開(kāi)引進(jìn)高層次、急需緊缺人才備考題庫(kù)完整答案詳解
- 常規(guī)體檢指標(biāo)講解
- 新人教版高中數(shù)學(xué)必修第二冊(cè)-第八章 立體幾何初步 章末復(fù)習(xí)【課件】
- 倉(cāng)庫(kù)物料效期管理制度
- GB/T 157-2025產(chǎn)品幾何技術(shù)規(guī)范(GPS)圓錐的錐度與錐角系列
- TD/T 1041-2013土地整治工程質(zhì)量檢驗(yàn)與評(píng)定規(guī)程
- T/CCT 017-2024中低溫煤焦油
- 2025年上海市崇明區(qū)高考英語(yǔ)一模試卷
- 電子公司生產(chǎn)部年終工作總結(jié)
- ISO27001:2022信息安全管理體系全套文件+表單
- 《資治通鑒》與為將之道知到課后答案智慧樹(shù)章節(jié)測(cè)試答案2025年春武警指揮學(xué)院
- 2024大型企業(yè)司庫(kù)體系建設(shè)白皮書(shū)
評(píng)論
0/150
提交評(píng)論