數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件_第1頁
數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件_第2頁
數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件_第3頁
數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件_第4頁
數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件_第5頁
已閱讀5頁,還剩109頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

數(shù)據(jù)結(jié)構(gòu)棧英文版數(shù)據(jù)結(jié)構(gòu)棧英文版1CHAPTER2INTRODUCTIONTOSTACKS【學(xué)習(xí)內(nèi)容】BASICCONCEPTS1.StackSpecifications2.ImplementationofStacks3.Application:ADeskCalculator4.ApplicationBracketMatching5.AbstractDataTypesandTheirimplementationsCHAPTER22VocabularStack堆棧StackTop棧頂Pushstack入棧Popstack出棧Overflow上溢出Underflow下溢出Parse解析,語法分析IFO后進(jìn)先出enumeratedtype枚舉類型(C++中沒講,請查書自行補(bǔ)上)Vocabular32.1STACKSPECIFICATIONS2.1.1Listsandarrays2.1.2Stacks2.1.3FirstExample:ReversingaList2.1.4InformationHiding2.1.5TheStandardTemplateLibrary2.1STACKSPECIFICATIONS42.1.1ListsandArraysDefinitionalinearlistisalistinwhicheachelementhasauniquesuccessor.ArrayisatypicallinearliststructureProperty:sequential2.1.1ListsandArrays5questionReadanintegern,whichwillbeatmost25,thenreadalistofnnumbers,andprintthelistinreverseorderquestion62.1.2StacksDefinitionAstackisalastin-firstout(LIFOdatastructureinwhichallinsertionanddeletionarerestricttooneend.calledtopPopStackPushStackopmaxstack-bottomL2.1.2Stacks7UnderstandstackYoucanimaginestackasthisbarrel,whenyouwanttoputtheblackpieintothebarrel,youjustputitonthetopoftheorangeone.Meanwhile,whenyouwanttogettheredpie,youshouldfirstpopuptheothertwopies,andthenyoucangettheredoneUnderstandstack82.1.3FirstExample:ReversingaListAsasimpleexampleoftheuseofstacks,letuswriteaprogramtosolvetheproblemofSection2.1Ourprogrammustreadanintegern,followedbynfloating-pointnumbers.ItthenwritesthemoutinreverseorderWecanaccomplishthistaskbypushingeachnumberintoastackasitisread.Whentheinputisfinished,Wepopnumbersoffthestack,andtheywillcomeoffinthereverseorder2.1.3FirstExample:Reversing9PushingandpoppingastackPushingandpoppingastack10StandardTemplateLibrary(STL)Thestandardtemplatelibrary(abbreviatedSTLinC++containsmuchuseftinformation,manyfunctions,andmanyclassesWecanincludethestlstackimplementationintoourprogramswiththedirective#include<stack>andthenwecandefineandinitializeemptystackobjectsandapplymethodscalledpushpop,topandemptyStandardTemplateLibrary(STL11數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件12數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件13數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件14數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件15數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件16數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件17數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件18數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件19數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件20數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件21數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件22數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件23數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件24數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件25數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件26數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件27數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件28數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件29數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件30數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件31數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件32數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件33數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件34數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件35數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件36數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件37數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件38數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件39數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件40數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件41數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件42數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件43數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件44數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件45數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件46數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件47數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件48數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件49數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件50數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件51數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件52數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件53數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件54數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件55數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件5626、要使整個(gè)人生都過得舒適、愉快,這是不可能的,因?yàn)槿祟惐仨毦邆湟环N能應(yīng)付逆境的態(tài)度?!R梭

27、只有把抱怨環(huán)境的心情,化為上進(jìn)的力量,才是成功的保證?!_曼·羅蘭

28、知之者不如好之者,好之者不如樂之者。——孔子

29、勇猛、大膽和堅(jiān)定的決心能夠抵得上武器的精良?!_(dá)·芬奇

30、意志是一個(gè)強(qiáng)壯的盲人,倚靠在明眼的跛子肩上?!灞救A謝謝!5726、要使整個(gè)人生都過得舒適、愉快,這是不可能的,因?yàn)槿祟惐財(cái)?shù)據(jù)結(jié)構(gòu)棧英文版數(shù)據(jù)結(jié)構(gòu)棧英文版58CHAPTER2INTRODUCTIONTOSTACKS【學(xué)習(xí)內(nèi)容】BASICCONCEPTS1.StackSpecifications2.ImplementationofStacks3.Application:ADeskCalculator4.ApplicationBracketMatching5.AbstractDataTypesandTheirimplementationsCHAPTER259VocabularStack堆棧StackTop棧頂Pushstack入棧Popstack出棧Overflow上溢出Underflow下溢出Parse解析,語法分析IFO后進(jìn)先出enumeratedtype枚舉類型(C++中沒講,請查書自行補(bǔ)上)Vocabular602.1STACKSPECIFICATIONS2.1.1Listsandarrays2.1.2Stacks2.1.3FirstExample:ReversingaList2.1.4InformationHiding2.1.5TheStandardTemplateLibrary2.1STACKSPECIFICATIONS612.1.1ListsandArraysDefinitionalinearlistisalistinwhicheachelementhasauniquesuccessor.ArrayisatypicallinearliststructureProperty:sequential2.1.1ListsandArrays62questionReadanintegern,whichwillbeatmost25,thenreadalistofnnumbers,andprintthelistinreverseorderquestion632.1.2StacksDefinitionAstackisalastin-firstout(LIFOdatastructureinwhichallinsertionanddeletionarerestricttooneend.calledtopPopStackPushStackopmaxstack-bottomL2.1.2Stacks64UnderstandstackYoucanimaginestackasthisbarrel,whenyouwanttoputtheblackpieintothebarrel,youjustputitonthetopoftheorangeone.Meanwhile,whenyouwanttogettheredpie,youshouldfirstpopuptheothertwopies,andthenyoucangettheredoneUnderstandstack652.1.3FirstExample:ReversingaListAsasimpleexampleoftheuseofstacks,letuswriteaprogramtosolvetheproblemofSection2.1Ourprogrammustreadanintegern,followedbynfloating-pointnumbers.ItthenwritesthemoutinreverseorderWecanaccomplishthistaskbypushingeachnumberintoastackasitisread.Whentheinputisfinished,Wepopnumbersoffthestack,andtheywillcomeoffinthereverseorder2.1.3FirstExample:Reversing66PushingandpoppingastackPushingandpoppingastack67StandardTemplateLibrary(STL)Thestandardtemplatelibrary(abbreviatedSTLinC++containsmuchuseftinformation,manyfunctions,andmanyclassesWecanincludethestlstackimplementationintoourprogramswiththedirective#include<stack>andthenwecandefineandinitializeemptystackobjectsandapplymethodscalledpushpop,topandemptyStandardTemplateLibrary(STL68數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件69數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件70數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件71數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件72數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件73數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件74數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件75數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件76數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件77數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件78數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件79數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件80數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件81數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件82數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件83數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件84數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件85數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件86數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件87數(shù)據(jù)結(jié)構(gòu)-棧-英文版課件

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論