版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
浙江大學(xué)2005–2006學(xué)年冬季學(xué)期《高級數(shù)據(jù)結(jié)構(gòu)與算法》課程期末考試試卷開課學(xué)院:軟件學(xué)院,考試形式:閉卷,允許帶__入場考試時間:_2005_年_1_月_10_日,所需時間:120分鐘考生姓名:___學(xué)號:專業(yè):____教師:題序一二三四總分得分評卷人NOTE:Pleasewriteyouranswersontheanswersheet.注意:請將答案填寫在答題紙上。Pleasefillintheblanks(Therecouldbemultipleanswersforoneblank).(30points)Note:Zeropointforablankselectionsincethereisatleastoneanswerforeachproblem.(1)ForanAVLtree,is(are)correct.(2points) a.Theheightofleftandrightsub-treesdiffersbyatmost1. b.TheinsertionoperationcanbeperformedinO(logN)time. c.AnAVLtreeisakindofbinarysearchtree. d.ThepurposeofusingAVLtreeistosavesomespace.(2)AnAVLtreeofheight6hastheminimumsizeofnodes.(2points) a.31 b.32 c.33 d.34(3)ForaB-tree,is(are)correct.(2points) a.AB-treeisnotasearchtree.b.Alltheleaveshavethesamedepth.c.Allnon-leafnodesofa2-3treehave1or3children.d.GenerallyaB-treeisnotabinarytree.(4)Foraleftistheap,is(are)NOTcorrect.(2points)a.Thetotalnumberofnodesintheleftsub-treeisalwaysnolessthanthatintherightsub-tree.b.AleftistheapofNnodeshasarightpathcontainingatmostlog(N+1)nodes.c.Comparingtobinaryheaps,leftistheapsaremoresuitabletodomerge.d.Abinaryheapisalsoaleftistheap.(5)Foraskewheap,is(are)NOTcorrect.(2points)a.Skewheapisakindofleftistheap.b.Therightpathofaskewheapcanbearbitrarilylong.c.Comparingtoleftistheaps,skewheapsarealwaysmoreefficientinrunningtimeforeverymerge.d.Comparingtoleftistheaps,skewheapsarealwaysmoreefficientinspace.(6)Amongthefollowingstatements,is(are)correct.(2points)a.TheamortizedtimeisanaveragetimeofNsuccessiveoperations.b.Theamortizedtimeistheworst-casetimeofNsuccessiveoperationsintotal.c.ThepotentialfunctionofNsuccessiveinsertionsofabinomialqueueisthenumberoftrees.d.Theamortizedtimecouldbemuchmorethantheactualtimeforoneoperation.(7)Forthefollowings,theO(logN)case(s)is(are),theO(N)case(s)is(are).(2points)a.Theworst-caserunningtimeofmergingtwoleftistheaps.b.Theworst-caserunningtimeofmergingtwoskewheaps.c.Theamortizedcostpermergeofaskewheap.d.BuildingaleftistheapfromNnumbers.(8)Forthefollowingproblems,is(are)undecidableproblem(s)andis(are)NP-completeproblem(s).(3points)a.Eulercircuitproblemb.Hamiltoniancycleproblemc.Satisfiabilityproblemd.Haltingprobleme.All-pairsshortestpathsproblemf.Binpackingproblem(9)Forthefollowingstatements,is(are)NOTcorrect.(2points)a.AllNPproblemsaredecidable.b.AllNP-completeproblemsareNPproblems.c.AlldecidableproblemsareNPproblems.d.AllNPproblemscanbesolvedinpolynomialtimeinanon-deterministicmachine.(10)Forabinomialqueuecontaining23nodes,pleasegivethenamesofnon-emptybinomialtreesinthisbinomialqueue(e.g.B0,B1,B3):.(5points)(11)Theturnpikereconstructionproblemistoreconstructapointsetfromdistancesbetweeneverypairofpoints.Givenasetofdistances{1,2,3,3,4,5,7,7,8,10},thecorrespondingpointsetcontainspointswithcoordinates.(6points)Giventhefunctiondescriptionsofthefollowingtwoprograms,pleasefillintheblanklinesofcode.(15points)(1)AsinglerotationbetweennodeK1anditsrightchildinanAVLtree.(9points)structAvlNode{ElementTypeElement;AvlTreeLeft;AvlTreeRight;intHeight;}TypedefstructAvlNode*Position;TypedefstructAvlNode*AvlTree;staticPositionSingleRotateWithRight(PositionK1){ PositionK2;;;;K1->Height=Max(Height(K1->Left),Height(K1->Right))+1;K2->Height=Max(Height(K2->Right),K1->Height)+1;returnK2;}(2)Findingtheoptimalorderingofmatrixmultiplications.(6points)voidOptMatrix(constlongr[],intN,TwoDimArrayM){inti,k,Left,Right;longThisM;for(Left=1;Left<=N;Left++)M[Left][Left]=0;for(k=1;k<N;k++)for(Left=1;Left<=N-k;Left++){Right=Left+k;M[Left][Right]=Infinity;for(L=Left;L<Right;L++){;if(ThisM<M[Left][Right]);}}}
Pleasewriteordrawyouranswersforthefollowingproblemsontheanswersheet.(40points)(1)Pleasedrawtheresultsofinserting{6,7,8,9,10,1,2,3,4,5}intoa.(6points)aninitiallyemptyAVLtree;andb.(7points)aninitiallyemptysplaytree.(Tip:Drawingthetreesstepbystepmighthelpyougettingpartialcredits.)33817182673718241233211410236(2)Pleasedrawtheresultofdeletingtheminimumnumberfromthegivenleftistheap.(5points)(3)Pleasedrawtheresultofmergingthegiventwobinomialqueues.(5points)132313235124651518211295512212465142616184H2:(4)Givenasegmentoftextthis_is_a_strange_string,howmanybitsarerequiredtostorethestringas1-bytecharacters?HowmanybitsareneededtostoreitsHuffmancode?PleasedrawtheHuffmantreewiththefollowingassumptions:a.Allthecharactersareinitiallystoredinanarrayinthealphabeticalorder;andb.Alltheleftbranchesarecodedwith0’sandalltherightbranchesarecodedwith1’s.(10points)(5)Pleaseshowtheoptimalbinarysearchtreeforthefollowingwords,wherethefrequencyofoccurrenceisinparentheses:an(0.10),be(0.20),can(0.30),if(0.25),or(0.15).(7points)GiventheadjacencymatrixGofaweightedgraph,withG[k][k]presumedtobe0.PleasewriteanalgorithmwithtimecomplexityO(N3)forprintingtheshortestpathsbetweenanytwoverticesI,andjforall0I<j<N.Thatis,youroutputmusthavetheformatasthefollowing:(15points)0->…->1……0->…->N–11->…->2……1->…->N–1……N–2->…->
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(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)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 工程測量勞動合同
- 出口貨物報關(guān)代理合同
- 正式公司轉(zhuǎn)讓合同格式
- 2024年廣告位合同范本
- 2024貸款還款協(xié)議書
- 家庭裝修項(xiàng)目協(xié)議書樣本
- 2024年單位租車協(xié)議書樣本
- 建設(shè)工程地基處理協(xié)議書
- 權(quán)威委托代理合同范文大全
- 房屋拆遷合同經(jīng)典版本
- 2024年農(nóng)業(yè)農(nóng)村部大數(shù)據(jù)發(fā)展中心第三批面向社會公開招聘7人(高頻重點(diǎn)復(fù)習(xí)提升訓(xùn)練)共500題附帶答案詳解
- 城市梁橋拆除工程安全技術(shù)規(guī)范
- 《食品添加劑應(yīng)用技術(shù)》第二版 課件 任務(wù)1.2 食品添加劑使用標(biāo)準(zhǔn)檢索-1標(biāo)準(zhǔn)解讀
- 河北省保定市勞動合同范本
- 脫硫計算公式
- 中國兒童有聲讀物行業(yè)市場現(xiàn)狀分析及競爭格局與投資發(fā)展研究報告2024-2029版
- 二年級100以內(nèi)加減乘除混合口算題(直接打印)
- 醫(yī)院大中型設(shè)備成本效益分析表格
- 青春期性教育知識完整版課件
- 新課標(biāo)“物聯(lián)網(wǎng)實(shí)踐與探索”模塊教學(xué)設(shè)計與實(shí)施
- 無人機(jī)足球團(tuán)體對抗賽項(xiàng)目競賽規(guī)則
評論
0/150
提交評論