版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 辦公場地租賃押金管理細(xì)則協(xié)議2025年
- 2024年中考道德與法治(上海)第二次模擬考試(含答案)
- 2025年海南省公需課學(xué)習(xí)-重點排污單位自動監(jiān)測數(shù)據(jù)標(biāo)記規(guī)則第344期
- 冰點文庫撈鐵牛課件
- 2025年中考沈陽歷史試卷及答案
- 2025年共同條例考核試卷及答案
- 景區(qū)輪船維修合同范本
- 2025年高熱度智商測試題及答案
- 2025年行政管理常識題庫及答案
- 礦山承包協(xié)議合同范本
- 2025年滄州幼兒師范高等??茖W(xué)校招聘真題(行政管理崗)
- 2025國家統(tǒng)計局齊齊哈爾調(diào)查隊招聘公益性崗位5人筆試考試參考試題及答案解析
- 個人素質(zhì)與修養(yǎng)課件
- 男性性教育課件
- 藝術(shù)鑒賞教程課件
- 三級醫(yī)院臨床科室醫(yī)療質(zhì)量管理考核標(biāo)準(zhǔn)
- 2025 年高職酒店管理(人力資源管理)試題及答案
- 危重患者的容量管理
- 2025秋四年級上冊勞動技術(shù)期末測試卷(人教版)及答案(三套)
- 2025年應(yīng)急物資準(zhǔn)備安全培訓(xùn)試卷及答案:物資管理人員應(yīng)急物資使用測試
- 電商售后客服主管述職報告
評論
0/150
提交評論