

下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
ISingleChoice(10 )Forthefollowingprogramfragmenttherunningtime(Big-Oh)is i=0;s=while(s<(5*n*n+ s=s+}a. b. c. d. )Whichisnon-lineardata a. c. d.sequence )Theworst-timeforremovinganelementfromasequence (Big-Oh) a. b. c. d. )Inacircularqueuewecandistinguish(區(qū)分)emptyqueuesfromfullqueues usingagapintheincrementingqueuepositionsby2insteadof1c.keeacountofthenumberofelementsd.aand )Arecursivefunctioncancauseaninfinitesequenceoffunctioncalls theproblemsizeishalvedateachtheterminationconditionisnousefulincrementalcomputationisdoneineachtheproblemsizeis )Thefullbinarytreewithheight4 a. b. )Searchinginanunsortedlistcanbemadefasterby binaryasentinel(哨兵)attheendofthelinkedlisttostoretheaand )Supposethereare3edgesinanundirectedgraphG, IfwerepresentgraphGwithaadjacencymatrix,Howmany“1”sarethereinthematrix?a. b. c. d. )ConstructaHuffmantreebyfourleafwhoseweightsare9,2,5,7respectively.Theweightedpathlengthis a. b. c. ConsiderthefollowingweightedConsiderDijkstra’salgorithmonthisgraphtofindtheshortestpathswithsasastartingvertex.Whicharethefirstfourverticesextractedfromthepriorityqueuebythealgorithm(listedintheordertheyareextracted)?a.s,y,t, b.s,y,x, c.s,t,y, d.s,y,x,Fig.Hereisanarrayoftenintegers:5389170264Supposewepartitionthisarrayusingquicksort'spartitionfunctionandusing5forthepivot.Whichshowsthearrayafterpartitionfinishes:534210796034215796310245896310245897NoneoftheFillinBlank(10Forthefollowingprogramfragmenttherunningtime(Big-Oh)is for(inti=0;i<n;i++)for(intj=0;j<=i; //sWestorea4×4symmetricmatrixAintoanarrayBwithrowmajororder,Storethelowertriangleonly.theindexofelementa[2][3]inBis Wecanuse3vectortypetostorevalueand ofnon-zeroelementsinasparsematrix. isalistwhereremovalandadditionoccuratthesameend.FrequentlyknownaLIFO(Last-In-First-Out)structure.T(n)=2T(n/2)+ T(n)=T(n- T(n)= Thereisabinarytreewhoseelementsarecharacters.Preorderlistofthebinarytreeis“ABECDFGHIJ”andinorderlistofthebinarytreeis“EBCDAFHIGJ”.Postordertraversalsequenceofthebinarytreeis There leafnodesinafullbinarytreewithn8.Whentheinputhasbeensorted,therunningtimeofinsertionsort(Big-Oh) 9.Wesortthesequence(43,02,80,48,26,57,15,73,21,24,66)withssortincrement3,theresultis _sizeis“maxsize”.Wheninsertanelementinthequeue,rear= 11.A isanexampleofasearchtreewhichismultiway(allowsmorethantwochildren).12.Atreeinwhicheverynodeisnosmallerthanitschildrenis ApplicationofAlgorithms(35GraphGshowninFig2isadirectedgraph,pleasedescribeGwithadjacencymatrixandwritetheordersofbreadthfirsttraversalanddepthfirsttraversal.BBCAEDThesequenceofinputkeysisshownbelow:Afixedtablesizeof19andahashfunctionH(key)=key%13,withlinearprobing(線性探測(cè)),fillthetablebelowandcomputetheaveragelengthofsuccessfulsearch.Showtheresultsofinserting53,17,78,09,45,65,87each,oneatatime,inainitiallyemptymaxwritethesequenceofpreorder,postordertraversalsandaddinorderthreadsintheAABCDEFFig.BuildaHuffmantreeand determineHuffmancodewhentheprobabilitydistribution(概率分布)overthe8alphabets(c1,c2,c3,c4,c5,c6,c7,c8)is(0.05,0.25,0.03,0.06,0.10,0.11,GraphGshowninFig4isadirectedgraph,pleasedescribeGwithadjacencylistandwritetopologicalordering.Fig.Fillinblankofalgorithms.1.HereissinglesourceshortestpathalgorithmDijkstraFillinblankofthealgorithm.classGraph{ floatfloatdist[NumVertices];//最短路徑長度數(shù)組intpath[NumVertices]; intS[NumVertices]; voidShortestPath(int, int);intchoose(int);voidGraph::ShortestPath(int intv//n個(gè)頂點(diǎn)的帶權(quán)有向圖中,Edge[i][j]給出。建立一個(gè)數(shù)組dist[j],0j<n,//vj的最短路徑長度,path[j],0j<n,for(inti=0;i<n;i++)dist[i] //distS[i]=if(i!=v&&dist[i]<MAXNUM)path[i]=v;elsepath[i]=-1; //path數(shù)組初始化}S[v] dist[v] //頂點(diǎn)v//選擇當(dāng)前不在集合S中具有最短路徑的頂點(diǎn)ufor(i=0;i< ;i++){floatmin=MAXNUM; intu=v;for(intj=0;j<n;j++)if(!S[j] {u= min=dist[j];S[u]=1; //將頂點(diǎn)u加入集合Sfor(intw=0;w<n;w++) if(!S[w]&&Edge[u][w]<MAXNUM {dist[w] path[w]= }(圓括號(hào))andnumbers.PleaseFillinblank.#include<stack>Usingnamespaceintmatching(string&exp)//expisapointertoastringtocheckintstate=1,i=0;chare;stack<char>s;while(i<exp.length()&&state)switch(exp[i]){case;case')':if ) i++;state=0; //anerroroccursi++; //endofif return returnProgrammingWriteefficientfunctions(andgivetheirBig-Ohrunningtimes)thattakeapointertoabinarytreerootTandcompute:–ThenumberofleavesofTtypedefstructBiTNode struct }BiTNode,WriteamethodcalledumDegreeofanundirectedhgraphthatreturnstheumdegreeofanyvertexinthegraph.Thegraphisstoredwithadjacencymatrix.Writethedefinitiono
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 咖啡市場(chǎng)分析與調(diào)研試題及答案
- 內(nèi)資股東轉(zhuǎn)讓合同二零二五年
- 二零二五最高額保證擔(dān)保合同范例
- 房地產(chǎn)買賣合同模板
- 倉庫出租合同二零二五年
- 二零二五版自擬離婚協(xié)議范例
- 二零二五版呼和浩特二手房買賣合同
- 睫毛產(chǎn)品知識(shí)培訓(xùn)課件
- 橋板運(yùn)輸安裝安全協(xié)議書
- 二零二五裝修委托協(xié)議合同范例
- 2023北京海淀初一(下)期末英語試卷含答案
- 內(nèi)蒙古達(dá)茂旗明水元墓出土絲織品的初步研究
- 質(zhì)量手冊(cè)前言部分201007
- 電力設(shè)備生產(chǎn)項(xiàng)目技術(shù)方案
- 2023年上海嘉定工業(yè)區(qū)招聘筆試參考題庫附帶答案詳解
- 村居hao優(yōu)質(zhì)獲獎(jiǎng)?wù)n件
- 丹東鑫源供熱有限責(zé)任公司擴(kuò)建一臺(tái)64MWh熱水鍋爐工程項(xiàng)目環(huán)境影響報(bào)告
- 礦井瓦斯防治課件版 第13章 煤與瓦斯突出分類、特點(diǎn)、機(jī)理及規(guī)律
- 2023年中科院生態(tài)學(xué)考博真題題匯總
- 藥劑科主任崗位權(quán)責(zé)目錄及廉政風(fēng)險(xiǎn)防控措施登記表
- 2023年鞍鋼集團(tuán)招聘筆試題庫及答案解析
評(píng)論
0/150
提交評(píng)論