资源描述:
《数据结构试卷(一)参考答案3199(data structure test paper (a) refer to answer 3199)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、数据结构试卷(一)参考答案3199(Datastructuretestpaper(a)refertoanswer3199)17,readagoodbook,likemakingagoodfriend--CangkejiaDatastructuretestpaper(a)referenceanswersFirst,themultiple-choicequestions(2pointspergame,20points)1.A,2.D,3.D,4.C,5.C,6.D,7.D,8.C,10.A,9.DTwo,fillintheblanks(1pointsperminute,26points)1.acc
2、uracy,readability,robustness,efficiency2.O(n)3.9334.-134X*+2Y*3/-5.2nn-1n+16.e2e7.directedacyclic8.n(n-1)/2n(n-1)9.(12,40)()(74)(23,55,63)10.increaseby111.O(log2n)O(nlog2n)12.mergeThree,thecalculationquestions(6pointspergame,24points)1.lineartablesare:(78,50,40,60,34,90)2.adjacencymatrix:Theadjacenc
3、ytableisshowninfigure11:Figure113.theminimumspanningtreeobtainedbytheKruskalalgorithmis:(1,2)3,(4,6)4,(1,3)5,(1,4)8,(2,5)10,(4,7)20;4.seeFigure12Figure12Four,readalgorithm(7pointspergame,atotalof14points)1.(1)querythetailnodeofthelist(2)linkthefirstnodetothetailofthelistasthenewtailnode(3)thereturne
4、dlineartablesare(A2,A3,...,an,A1)2.recursivetraversalchainstorageoftwoforktreeFive.Fillintheblanks(2centsperminute,8pointseach)TrueBST->leftBST->rightSix,writealgorithms(8points)IntCountX(LNode*,HL,ElemType,x){inti=0;LNode*p=HL;//iiscounterWhile(P,=NULL){if(P->data==x)i++;P=p->next;}//while,whenthel
5、oopisout,thevalueinIisthenumberofXnodesReturni;}//CountXDatastructuretestpaper(two)referenceanswerFirst,themultiple-choicequestion1.D,2.B,3.C,4.A,5.A,6.C,7.B,8.CTwo.Fillintheblanks1.constructagoodHASHfunctionanddeterminethesolutiontotheconflict2.stack.top++,stack.s[stack.top]=x3.order4.O(N2),O(nlog2
6、n)5.N0-1,2N0+N16.d/27.(31,38,54,56,,75,80,55,63)8.(1,3,4,5,2),(1,3,2,,4,5)Three.Applicationquestions1.(22,40,45,48,80,78),(40,45,48,,80,22,78)2.q->llink=p;q->rlink=p->rlink;p->rlink->llink=q;p->rlink=q;3.2,ASL=91*1+2*2+3*4+4*2)=25/94.treechainstoragestructureslightly,twoforktreeslightly5.E={(1,3),(1
7、,2),(3,5),(5,6),(6,4)}6.Four,algorithmdesignThe1.isprovidedwithasetofinitialrecordkeysequence(K1,K2,...,Kn),requiredtodesignanalgorithmtoO(n)timecomplexityinthelineartableisdividedintotwoparts,theleft