下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
?Da?DataStructure?A試卷題號(hào)一二三四五六七八九十一總分得分評(píng)卷人考前須知:1.考前請(qǐng)將密封線內(nèi)填寫清楚;2.所有答案請(qǐng)直接答在試卷上;3.測(cè)試形式:閉卷;4.本試卷共十大題,總分值100分,測(cè)試時(shí)間120分鐘.1.Selectthecorrectchoice.(20scores,each2scores)誠(chéng)信應(yīng)考,測(cè)試作弊將帶來(lái)嚴(yán)重后果!華南理工大學(xué)期末測(cè)試⑴AnalgorithmmustbeordoallofthefollowingEXCEPT:(B)(A)Partiallycorrect(B)Ambiguous(C)terminate(D)ConcretestepsPickthegrowthratethatcorrespondstothemostefficientgrowingalgorithmasngetslarger:(B)(A)4n3(B)5n2logn(C)3n!(D)2nIfadataelementrequires12bytesandapointerrequires4bytes,thenalinkedlistrepresentationwillbemorespaceefficientthanastandardarrayrepresentationwhenthefractionofnon-nullelementsislessthanabout:(B)(A)1/3(B)3/4(C)3/5(D)2/3Whichistherealizationofadatatypeasasoftwarecomponent:(A)(A)Anabstractdatatype(B)Arealdatatype(C)Atype(D)AdatastructureThemosteffectivewaytoreducethetimerequiredbyadisk-basedprogramisto:(B)(A)ImprovethebasicI/Ooperations.(B)Minimizethenumberofdiskaccesses.(C)Eliminatetherecursivecalls.(D)Reducemainmemoryuse.Inthehashfunction,collisionrefersto(B).Twoelementshavethesamekeyvalue.Differentkeysaremappedtothesamepositionofhashtable.Tworecordshavethesamerequiringnumber.Dataelementsaretoomuch.GivenanarrayasA[m][n].SupposedthatA[0][0]islocatedat644(io)andA[4][4]isstoredat676i.).(彳0)“meansthatthenumberispresentedindecimals.ThentheelementA[2][2](io)isatposition:(B)(A)692(B)660(C)650(D)708Whichstatementisnotcorrectamongthefollowingfour:(A)Thenumberofemptysub-treesinanon-emptybinarytreeisonelessthanthenumberofnodesinthetree.TheMergesortisastablesortingalgorithm.Therootofabinarytreetransferredfromageneraltreehasonlyleftchild.Asectoristhesmallestunitofallocationforarecord,soallrecordsoccupyamultipleofthesectorsize.(9)Treeindexingmethodsaremeanttoovercomewhatdeficiencyinhashing?(D)(A)Inabilitytohandlerangequeries.(B)Inabilitytomaximumqueries(C)Inabilitytohandlequeriesinkeyorder(D)Allofabove.(10)Assumethatwehaveeightrecords,withkeyvaluesAtoH,andthattheyareinitiallyplacedinalphabeticalorder.Now,considertheresultofapplyingthefollowingaccesspattern:FDFGEGFADFGEifthelistisorganizedbythetransposeheuristic,thenthefinallistwillbe(B).(A)AFCDHGEB(B)ABFDGECH(C)ABFGDCEH(D)AHFDGECBFilltheblankwithcorrectC++codes:(16scores)Givenanarraystoringintegersorderedbyvalue,modifythebinarysearchroutinestoreturnthepositionofthefirstintegerwiththeleastvaluegreaterthanKwhenKitselfdoesnotappearinthearray.ReturnERRORifthegreatestvalueinthearrayislessthanK:(10scores)//Returnpositionoflestelement>=Kintnewbinary(intarray[],intn,intK){intl=-1;intr=n;//landrbeyondarrayboundswhile(l+1!=r){//Stopwhenlandrmeet_inti=(l+r)/2一;//Checkmiddleofremainingsubarrayif(K<array[i])r=i;//Inlefthalfif(K==array[i])returni;//Founditif(K>array[i])l=i//Inrighthalf}——//KisnotinarrayorthegreatestvalueislessthanKifK<array[n-1]orr!=nthenreturnr;//thefirstintegerwiththeleastvaluegreaterthanK//whenKitselfdoesnotappearinthearrayelsereturnERROR;//thegreatestvalueinthearrayislessthanK}⑵Theheightoftheshortesttreeandthetallesttreewithbothnnodesisrespectively
_2_orn(n<2)and__n_,supposethattheheightoftheone-nodetreeis1.A3-aryfulltreewithninternalnodeshas__3n+1_nodes.(6scores)Pleasecalculatethenumberofbinarytreesindifferentshapewith6nodesintotal,and6nodes?(4scores)2nodes:2shapes3nodes:rootwith1and2canbeallocatedtoleftandrightso1+2+2=54nodes:3canbeallocatedas0,3;1,2;2so5+5+2+2=145nodes:14+14+5+5+4=426nodes:32+32+14+14+5*2*2=132,C2nn/n+1AcertainbinarytreehasthepostorderenumerationasDCBEHJIGFAandtheinorderenumerationasBCDAEFGHIJ.Trytodrawthebinarytreeandgivethepostorderenumeration.(Theprocessofyoursolutionisrequired!!!)(6scores)preorderenumeration:ABCDFEGIHJ5.Designanalgorithmtotransferthescorereportfrom100-pointto5-point,thelevelEcorrespondingscore<60,6cH69beingD,70?79beingC,80?89asB,score>=90asA.Thedistributiontableisasfollowing.Pleasedescribeyouralgorithmusingadecisiontreeandgivethetotalpathlength.(6scores)Scorein100-point0-5960-6970-7980-8990-100Distributionrate5%10%45%35%5%solution:thedesignlogicistobuildaHuffmantreeTotallength:4*10%+10%*3+35%*2+45%=1.85,the0-false,1-trueasthelogicbranches.Recoveryageneraltreeasfollowingtransferredfromabinarytree.(4scores)TracebyhandtheexecutionofQuicksortalgorithmonthearray:inta[]={44,77,55,99,66,33,22,88,79}Thepivotis66inthefirstpass,thesecondis55and88,thethirdis33and77,thefouris22,andsoontillthealgorithmisfinished.(6scores)initial:44,77,55,99,66,33,22,88,79pass1:442255336699778879TOC\o"1-5"\h\zpass2:442233556679778899pass3:332244556677798899pass4:223344556677798899finalsortedarray:223344556677798899(a)Describesimplythemaintasksofthetwophasesofexternalsorting.(4scoresThetaskoffirstphaseistobreakthefilesintolargeinitialrunsbyreplacementselection;thesecondphaseistomergetherunstogethertoformasinglesortedrunfile.(b)Assumethatworkingmemoryis512KBbrokenintoblocksof4096bytes(thereisalsoadditionalspaceavailableforI/Obuffers,programvariables,etc.)Whatistheexpectedsizeforthelargestfilethatcanbemergedusingreplacementselectionfollowedbytwopassesofmulti-waymerge?Explainhowyougotyouranswer.(4scores)Sinceworkingmemoryis512KBandtheblocksizeis4KB,theworkingmemoryholds128blocks.Theexpectedrunlengthis1024KB,soasinglepassofmultiwaymergeformsrunsoflength1024KB*128=128MB.Thesecondpassthenformsarunaslargeas128MB*128=16GB.Assumeadiskdriveisconfiguredasfollows.Thetotalstorageisapproximately675Mdividedamong15surfaces.Eachsurfacehas612tracks;thereare144sectors/track,512byte/sector,and16sectors/cluster.Thediskturnsat7200rmp(8.33ms/r).Thetrack-to-trackseektimeis20ms,andtheaverageseektimeis80ms.Nowhowlongdoesittaketoreadallofthedataina380KBfileonthedisk?Assumethatthefile'sclustersarespreadrandomlyacrossthedisk.AseekmustbeperformedeachtimetheI/Oreadermovestoanewtrack.Showyourcalculations.(Theprocessofyoursolutionisrequired!!!)(6cores)Aclusterholds16*0.5K=8K.Thus,thefilerequires380/8=47.5clusters.Thetimetoreadaclusterisseektimetothecluster+latencytime+(interleaffactorxrotation
time).Averageseektimeisdefinedtobe80ms.Latencytimeis0.5*8.33,andclusterrotationtimeis47.5*(16/144)*8.33.Seektimeforthetotalfilereadtimeis47*(80+0.5*600/72+(16/144)*600/72)+(80+0.5*600/72+(8/144*600/72))=4083.98msUsingclosedhashing,withdoublehashingtoresolvecollisions,insertthefollowingkeysintoahashtableofelevenslots(theslotsarenumbered0through10).ThehashfunctionstobeusedareH1andH2,definedb
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024版分布式能源管理系統(tǒng)建設(shè)合同
- 2024甲方乙方關(guān)于超高清視頻制作與版權(quán)的合同
- 2024深圳鹽田區(qū)旅游業(yè)務(wù)合作合同
- 2025版戶外旅游服務(wù)場(chǎng)地租賃及導(dǎo)游解說(shuō)服務(wù)合同3篇
- 二零二五年度房地產(chǎn)營(yíng)銷推廣服務(wù)合同2篇
- 轉(zhuǎn)包合同協(xié)議
- 機(jī)場(chǎng)排水系統(tǒng)建設(shè)合同
- 設(shè)計(jì)學(xué)院物業(yè)聘用合同
- 服裝設(shè)計(jì)公司財(cái)務(wù)顧問(wèn)服務(wù)合同
- 貴陽(yáng)市農(nóng)產(chǎn)品市場(chǎng)租賃合同
- 全過(guò)程工程咨詢作業(yè)指導(dǎo)書(shū)
- (完整版)形式發(fā)票模版(國(guó)際件通用)
- 機(jī)械設(shè)備租賃合同范本簡(jiǎn)單版(9篇)
- 城市生活垃圾分選系統(tǒng)設(shè)計(jì)
- 綠色施工管理體系與管理制度管理辦法(新版)
- 機(jī)動(dòng)車交通事故快速處理協(xié)議書(shū)(最新格式)
- 最新拉鏈廠安全操作規(guī)程
- 述職報(bào)告評(píng)分表
- 變壓器交接試驗(yàn)報(bào)告(1250)
- LOI外貿(mào)采購(gòu)意向(標(biāo)準(zhǔn)樣本)
- 水電交接確認(rèn)單(共2頁(yè))
評(píng)論
0/150
提交評(píng)論