數(shù)據(jù)結(jié)構(gòu)英文試題(修改)_第1頁(yè)
數(shù)據(jù)結(jié)構(gòu)英文試題(修改)_第2頁(yè)
數(shù)據(jù)結(jié)構(gòu)英文試題(修改)_第3頁(yè)
數(shù)據(jù)結(jié)構(gòu)英文試題(修改)_第4頁(yè)
數(shù)據(jù)結(jié)構(gòu)英文試題(修改)_第5頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

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

文檔簡(jiǎn)介

200X年試題選擇題(1)Suppose1,2,3,4istheorderwhichtheseelementspushontoastack.Thesequenceobtainedis(B)A.4.1.2.3B.3.2.4.1(2)Supposethatalinearlistcontainsn=31nodes,thebinarysearchisappliedtothelist,themaximumtimesinsearchingis(B)A4B5C25-1D24(3)Inthefollowingsortingalgorithms,whichisunstable(A)ASelectionsortBMergesortCBubblesortDInsertionsort(4)Bubblesortisusedfornnodes,theminimumnumberofcomparisonsis(A)An-1BnCn(n-1/2)Dn(n+1)/2(5)Howmanybinarytreesindifferentformscanatmostbebuiltbythreenodes?(B)A4B5C填空題.(1)Thestacktakesoncharacterof___________后進(jìn)先出____________________(2)Thepostfixexpressionis‘a(chǎn)bcdef*/-*+’.Itsinfixexpressionis_a+b[c-d/(e*f)]____(3)Theadvantageofcircularqueuesis_______克服隊(duì)滿溢出_________.(4)Ifthedepthoffullbinarytreeisk,thenthenumberofnodesinthetreeatleast_2^k+1-1__(5)Theselectionsortisusedtosortnnodes,thenumberofitscomparisonsis__n(n-1)/2____三.(1)WriteafunctionDeletioninCforlinearlist.(5points)intsq_elete(list,p_n,i) intlist[];/*形參數(shù)組可不指定大小*/ int*p_n,i; { intj; if(i<0||i>=*p_n)return(1); for(j=i+1,j<*p_n;j++)list[j-1]=list[j]; (*p_n)--; return(0);}(2)WriteafunctionPopinCforlinkedstack.(5points)(3)WriteafunctioninCforbinarysearch.(10point)intbisect(a,n,v)inta[],v,n;{inti,j,m;i=0;j=n-1;while(i<=j){m=(i+j)/2; if(v==a[m])return(m); if(v<a[m])j=m-1; elsei=m+1; }return(-1);}(4)WritesomesentencesinCwhichdeletethenodebinthefollowingfigure.(5point)(附圖)AABCP(5)WritesomesentencesinCwhichinsertthenodebinthefollowingfigure(5pont)(附圖)AACPBB四.(2)WriteafunctioninCofquicksort.(10point)PositionPartition(List*list,Posotionlow,Positionhigh){ListEntrypivot;Positioni,lastsmall,pivotpos;Swap(low,(low+high)/2,list);pivot=list->entry[low];pivotpos=low;for(i=low+1;i<=high;i++) if(LT(list->entry[i].key,pivot.key)) Swap(++pivotpos,i,list);Swap(low,pivotpos,list);returnpivotpos;}(3)Supposethatahashtablecontains5entriesindexedfrom0through4andthatthefollowingkeysaretobemappedintothetable.12,19,17,14,10,24,15Hashfunctionh(k)=kmod5.(a)Determinethehashaddressesandresolutecollisionbychaining.(b)WriteafunctioninCforsearchbychaining.(10point)voidsearch2(t,k,p,q)NODE*t[];intk;NODE*p,*q;{*p=NULL;*q=t[h(k)];while(*q!=NULL)if((*q)->key==k)return;else{*p=*q;*q=(*q)->link;}}五.(1)WriteafunctioninCwhichwillinterchangeallleftandrightsubtreesinbinarytree.(10point)(2)WriteafunctioninCforlinkedqueue.(10point)voidAppend(QueueEntryx,Queue*q){ if(QueueFull(q))Error(“cannotappendanentrytoafullqueue.”);else{ q->count++; q->rear=(q->rear+1)%MAXQUEUE; q->entry[q->rear]=x;}}選擇題Inasimplelinkedlistwithnnodes,thenumberofpointerfieldswithNULLTotals(D).A.nB.2C(2)Inthelinearlists,twoconceptswhicharethesameaseachotheris(AB)AnodeB.recordC.fieldD.typeofstructure(3)Inthebinarysearchtree,foranyrootofsubtree,thekeysofallnodesinitsleftsubtreeis(D)thekeysofallnodesinitsrightsubtree.AlessthanBequaltoCgreatthanDlessthanorequalto(4)Forgeneraltrees,thecorrectchoiceis(B)AitmaybeemptyBatleastonenodeCatleasttwonodesDA.BandCareincorrect(5)Thebubblesortisusedtonnodes,leastnumberofcomparisonis(A)An-1BnCn(n-1)/2Dn(n+1)/2填空題(1)Abinarytreewithnnodesstoragedbystandardform,thereare___2n__pointerswhere_n-1___pointersareusedtopointtosub-nodes,and_n+1___pointersareempty.(2)Thepostfixexpressionisabc*+de/f*-,thenitsinfixexpressionis_a+b*c-d/e*f___(3)Thebasicoperationsoflinearlistsare___插入刪除訪問______(4)Thecharacterofstackis__后進(jìn)先出__________(5)Hashstoragefacedwithtwoproblemsof__Hash函數(shù)____and____沖突___三.(1)WriteafunctionPopforstack(5point)VoidPop(StackEntry*item,Stack*s){if(StackEmpty(s))Error;else*item=S->entry[--s->top];}Translatethequadraticformula.(a+b*c)↑d↑(e*f/g)-h*iintopostfixform.(10point)WriteafunctioninCwhichchangesthelinkedlistinFigure1toanotherlinkedlistinFigure2.(10point)(附圖)(4)(1).(a)Byhand,tracethroughthestepsbubblesortwilluseonthelist.Thefollowingsevennumbertobesortedintoincreasingorder.(b)Writeafunctionofbubblesort.(10point)voidbubble_sort(a,n)inta[],n;{inti,j,t;n--;while(n>0){j=0; for(i=0;i<n;i++)if(a[i]>a[i+1]) {t=a[i]; a[i]=a[i+1]; a[i+1]=t; j=i;}n=j; }}(2)Byhand,sortthelist46.26.22.68.48.42.36.84.66usingselectionsort.Writeafunctionofselectionsort.(10point)voidinsertion_sort(a,n)inta[];intn;{inti,j;intt;for(i=1;i<n;i++){t=a[i];for(j=i-1;j>=0&&t<a[j];j--)a[j+1]=a[j];a[j+1]=t;}}(3).Supposethatahashtablecontains11entriesfrom0through10andthatthefollowingkeysaretobemappedintothetable.(32,75,63,48,94,25,36,18,70)Hashfunctionh(k)=kmod11(a)Determinethehashaddressesandresolutecollisionbylinearprobing.(b)Determinethehashaddressesandresolutecollisionbychaining.(10point)Foreachofthefollowingbinarytrees,determinetheorderinwhichthenodeswillbevisitedmixedordergivenbyinvokingf

溫馨提示

  • 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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論