版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
浙江大学2008–2009学年秋季《数据结构基础》课程期末考试试卷 ,考试形式:闭卷,允许带无入场考试时间:2008年11月3日,所需时间:120分钟,任课教师考生 学号 专业—二三四AnswerPartIPartII1. 2. PartIIIi0i0123456789i01234567894.4.4.4.PartIVboolIs_BST_sequence(intK[],intN/*XisstoredatK[N-1]NOTE:Pleasewriteyouranswersontheanswer注意:请将答案填写在答题纸上。Pleaseselecttheanswerforthefollowingproblems.(20Toinsertanodepointedbysafterthenodepointedbypinalinkedlist,weshoulddothefollowing (2points) b.s->next=p->next;p-c.s->next=p->next; d.p->next=s;s-Pushnnumbersontoastackintheorder1,2,…,nandpoptheminsomeordersotoobtainanoutputsequencek1,k2,…,kn.Ifk1=n,thenkimustbe (2points)a. b.n- c.n- d.cannotbeIfthemostcommonlyusedoperationsaretoinsertanelementafterthelastelement,andtodeletethefirstelement,thenthedatastructureforstoringtheelementswhichgivesthefastestperformanceis(2points)asinglylinked b.adoublylinkedasinglylinkedcircularlistwithaheadasinglylinkedcircularlistwithatailTofindanumberfrom100sortednumbersbybinarysearch,umnumberofcomparisonsa. b. c. d.
(2Givenaquadtree(四叉树)with5nodesofdegree2,3nodesofdegree3,2nodesofdegree4.Thenumberofleafnodesinthistreeis (2points)a. b. c. d.Abinarytreewhichgivesexactlythesameorderunderpreorderandpostordertraversalsmustbe (2points)anybinary b.atreewithonlytheatreeofwhicheachnodehasonlytheleftatreeofwhicheachnodehasonlytherightGivenanintegersequence{261184531217109}.sortingmethodwhichtakesthemostextraspaceinsertion b. c.merge d.heap
(2Ifnkeysarehashedintothesameslot,thentoinsertthesenkeys,theminimumnumberofprobeswithlinearprobingis(2points)a.n-1b.nc.n+1d.Astronglyconnectedgraphwithnverticshasatleastedges(2points)a.n(n-1)b.n- c.nd.GivenaweightedgraphG.Amongthefollowingstatements,istrue.(2points)LetTbeaminimumspanningtreeofG.ThenthepathinTbetweenanypairofverticesmustbeashortestpathinG.LetPbeashortestpathfromvtou.IftheweightofeachedgeinGisincreasedby1,Premainsashortestpathfromvtou.Lettheweightstandsfortheflowcapacity.Ifthereisatleastonepathfromstot,thentherealwaysexistsanedgesuchthatincreasingthecapacityofthatedgewillincreasetheumflowofG.Noneofthe descriptionsof thefollowingtwo programs,pleasefillintheblanklines.(21points)ThefunctionistosortNelementsbyheapsort.(12#defineleftchild(i)(2*(i)+1voidPercDown(ElementTypeA[],inti,intN{intfor(Tmp=A[i];leftchild(i)<N;I=child{child=if( childif( A[i]=A[child];elsebreak;} }voidHeapsort(ElementTypeA[],intN{intfor(i=N/2;i>=0;i--)/*BuildHeap*/PercDown(A,i,N);for(i=N-1;i>0;i--)Swap(&A[0],&A[i] }}ThefunctionistomodifyDijkstra'salgorithmsothatifthereismorethanoneminimumpathfromvtow,apathwiththefewestnumberofedgesischosen.(9points)voidDijkstra(TableT{/*T[v].Countstoresthenumberofedgesonthepathfromthesourcetov,/*andisinitializedtobe0vertexv,w;for(;;)v=smallestunknowndistancevertex;if(v==NotAVertex)T[v].Known=for(eachwadjacenttov)if(!T[w].Known)if(T[v].Dist+Cvw<T[w].Dist{Decrease(T[w].DisttoT[v]+Cvw)T[w].Path=v; ;elseif((T[v].Dist+Cvw==T[w].Dist&& {T[w].Count=T[v].Count+ ;}}Pleasewriteordrawyouranswersforthefollowingproblemsontheanswersheet.(44points)Givenalistofintegers{5,2,1,3,6,4,7}.Pleasedrawtheresultsofthefollowing:(10points)insertthenumbersintoaninitiallyemptymax-heap;storethenumbersintoanarrayandadjustthearrayintomax-Pleasefillthearraywiththeresultsafterthefollowingunion/findoperations. Note:Assumeunion-by-size(iftwosetsareequal-sized,thefirstrootwillbetherootoftheresult) pression.S[i]isinitializedtobe-1forall0i9.(5points)Givenahashtableofsize13andthehashfunctionh(x)=xmod13.Pleasefillinthehashtablewithinputnumbers{21531662529}.Assumethatquadraticprobingisusedtosolvecollisions.(7points)GivenagraphGasshowninthefigure.Pleasethedepth-firstspanningtree(5points); theminimumspanningtree(5 Pleaselistthearticulationpoints(5 PleaseaddexactlytwoedgestoGhencemakeGabiconnectedgraph(4 Note:DFSstartsatvertex1,andifthereare thanonebranchestogo,verticesmustbevisited
4 increasingGivenanarrayofintegers{718082943}.Pleaseshowhowtheorderofthenumberschanges
duringeachstepofquicksortwithmedian-of-threeforselectingthepivotandacutoffof3forinsertionYouonlyhavetoshowthearrayaftereachpivotiscedatitsfinalposition.Thefinalresultmustbeanon-decreasingsequence.(3points)1423WhensearchforagivennumberXinabinarysearchtreeT,westartfromtherootandfollowapathdowntoX.ThenumbersalongthatpathformthesearchsequenceforX1423{1423}isasearchsequencefor3inthebinarysearchtreeshownbythefigure.Ontheotherhand,{2413}isNOTasearchsequencesinceaccordingtothedefinitionofabinarysearchtree,1mustnotbeint
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024-2029全球及中国画框架行业市场发展分析及前景趋势与投资发展研究报告
- 2024-2029全球及中国用于统一威胁管理(UTM)的物联网安全解决方案行业市场发展分析及前景趋势与投资发展研究报告
- 生物材料行业经营分析报告
- 2024-2029全球及中国生宠物食品行业市场发展分析及前景趋势与投资发展研究报告
- 仓库货物入库合同范本
- 2024-2029全球及中国熔融陶瓷砂行业市场发展分析及前景趋势与投资发展研究报告
- 录像带录制行业相关项目诊断报告
- 2024年鼠抗人T淋巴细胞单克隆抗体项目申请报告范样
- 2024年放射源及生产装置项目规划申请报告模板
- 2024-2029全球及中国烟酸铬行业市场发展分析及前景趋势与投资发展研究报告
- 广东省深圳市福田区2023-2024学年七年级下学期期末数学试题
- 热点04 中法建交60周年-备战2024年中考地理热点专题解读与训练
- 24春国家开放大学《教育法学》终结性考试(大作业)参考答案
- 文印服务投标方案(技术方案)
- 2023年安徽省马鞍山二中实验班招生考试数学试题
- 篮球兴趣小组活动总结(通用5篇)
- 少儿主持第一课基础礼仪_图文.ppt
- 金属学与热处理原理(第三版)课后答案+全
- 企业跨国经营战略与管理人才培养需求调查问卷
- DB33T 1240-2021 建筑幕墙工程技术标准
- 市政排水管网水质与流量监测应用解决方案
评论
0/150
提交评论