數(shù)據(jù)結(jié)構(gòu)英文試題_第1頁
數(shù)據(jù)結(jié)構(gòu)英文試題_第2頁
數(shù)據(jù)結(jié)構(gòu)英文試題_第3頁
數(shù)據(jù)結(jié)構(gòu)英文試題_第4頁
數(shù)據(jù)結(jié)構(gòu)英文試題_第5頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、200X年試題選擇題Suppose1,2,3,4istheorderwhichtheseelementspushontoastack.Thesequenceobtainedis(B)A.4.1.2.3B.3.2.4.1C.3.4.1.2D.4.3.1.2Supposethatalinearlistcontainsn=31nodes,thebinarysearchisappliedtothelist,themaximumtimesinsearchingis(B)A4B5C25-1D24-1Inthefollowingsortingalgorithms,whichisunstable(A)ASel

2、ectionsortBMergesortCBubblesortDInsertionsortBubblesortisusedfornnodes,theminimumnumberofcomparisonsis(A)An-1BnCn(n-1/2)Dn(n+1)/2Howmanybinarytreesindifferentformscanatmostbebuiltbythreenodes?(B)A4B5C6D7填空題.(1)Thestacktakesoncharacterof后進(jìn)先出Thepostfixexpressionisabcdef*/-*+.Itsinfixexpressionis_a+bc-

3、d/(e*f)Theadvantageofcircularqueuesis克服隊滿溢出.(4)Ifthedepthoffullbinarytreeisk,thenthenumberofnodesinthetreeatleast_2Ak+1-1(5)Theselectionsortisusedtosortnnodes,thenumberofitscomparisonsis_n(n-1)/2三(1)WriteafunctionDeletioninCforlinearlist.(5points)intsq_elete(list,p_n,i)intIist;/*形參數(shù)組可不指定大小*/int*p_n,

4、i;intj;if(i=*p_n)return(1);for(j=i+1,j*p_n;j+)listj-1=listj;(*p_n)-;return(0);WriteafunctionPopinCforlinkedstack.(5points)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=am)return(m);if(ventrylow;pivotpos=low;for(i=low+1;ientryi.key,pivo

5、t.key)Swap(+pivotpos,i,list);Swap(low,pivotpos,list);returnpivotpos;Supposethatahashtablecontains5entriesindexedfrom0through4andthatthefollowingkeysaretobemappedintothetable.12,19,17,14,10,24,15Hashfunctionh(k)=kmod5.(a)Determinethehashaddressesandresolutecollisionbychaining.(b)WriteafunctioninCfors

6、earchbychaining.(10point)voidsearch2(t,k,p,q)NODE*t;intk;NODE*p,*q;*p=NULL;*q=th(k);while(*q!=NULL)if(*q)-key=k)return;else*p=*q;*q=(*q)-link;五.WriteafunctioninCwhichwillinterchangeallleftandrightsubtreesinbinarytree.(10point)WriteafunctioninCforlinkedqueue.(10point)voidAppend(QueueEntryx,Queue*q)if

7、(QueueFull(q)Error(“cannotappendanentrytoafullqueue.”);elseq-count+;q-rear=(q-rear+1)%MAXQUEUE;q-entryq-rear=x;選擇題Inasimplelinkedlistwithnnodes,thenumberofpointerfieldswithNULLTotals(D).A.nB.2C.n/2D.1Inthelinearlists,twoconceptswhicharethesameaseachotheris(AB)AnodeB.recordC.fieldD.typeofstructureInt

8、hebinarysearchtree,foranyrootofsubtree,thekeysofallnodesinitsleftsubtreeis(D)thekeysofallnodesinitsrightsubtree.AlessthanBequaltoCgreatthanDlessthanorequaltoForgeneraltrees,thecorrectchoiceis(B)AitmaybeemptyBatleastonenodeCatleasttwonodesDA.BandCareincorrectThebubblesortisusedtonnodes,leastnumberofc

9、omparisonis(A)An-1BnCn(n-1)/2Dn(n+1)/2填空題Abinarytreewithnnodesstoragedbystandardform,thereare_2n_pointerswhere_n-1_pointersareusedtopointtosub-nodes,and_n+1_pointersareempty.Thepostfixexpressionisabc*+de/f*-,thenitsinfixexpressionis_a+b*c-d/e*f_Thebasicoperationsoflinearlistsare_插入刪除訪問Thecharacterof

10、stackis_后進(jìn)先出Hashstoragefacedwithtwoproblemsof_Hash函數(shù)and沖突_WriteafunctionPopforstack(5point)VoidPop(StackEntry*item,Stack*s)if(StackEmpty(s)Error;else*item=S-entry-s-top;Translatethequadraticformula.(a+b*c)fdf(e*f/g)-h*iintopostfixform.(10point)WriteafunctioninCwhichchangesthelinkedlistinFigure1toano

11、therlinkedlistinFigure2.(10point)(附圖)(4).(a)Byhand,tracethroughthestepsbubblesortwilluseonthelist.Thefollowingsevennumbertobesortedintoincreasingorder.(b)Writeafunctionofbubblesort.(10point)voidbubble_sort(a,n)inta,n;inti,j,t;n;while(n0)j=0;for(i=0;iai+1)t=ai;ai=ai+1;ai+1=t;j=i;n=j;Byhand,sortthelis

12、t46.26.22.68.48.42.36.84.66usingselectionsort.Writeafunctionofselectionsort.(10point)voidinsertion_sort(a,n)inta;intn;inti,j;intt;for(i=1;i=0&tentry)B(root-left,Visit);B(root-right,Visit);voidB(TreeNode*root,void(*Visit)(TreeEbtryx)If(root)A(root-left,Visit);Visit(root-entry);A(root-right,Visit);五.(2)Insertanewnodertakenastherightchildofnodesanddrawathreaded-tree.(a)Byhand(b)Bysomese

溫馨提示

  • 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論