![數(shù)據(jù)結(jié)構(gòu)與算法試卷試題B_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-4/16/0722b31f-022f-49f2-b79c-c670f86ec914/0722b31f-022f-49f2-b79c-c670f86ec9141.gif)
![數(shù)據(jù)結(jié)構(gòu)與算法試卷試題B_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-4/16/0722b31f-022f-49f2-b79c-c670f86ec914/0722b31f-022f-49f2-b79c-c670f86ec9142.gif)
![數(shù)據(jù)結(jié)構(gòu)與算法試卷試題B_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-4/16/0722b31f-022f-49f2-b79c-c670f86ec914/0722b31f-022f-49f2-b79c-c670f86ec9143.gif)
![數(shù)據(jù)結(jié)構(gòu)與算法試卷試題B_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-4/16/0722b31f-022f-49f2-b79c-c670f86ec914/0722b31f-022f-49f2-b79c-c670f86ec9144.gif)
![數(shù)據(jù)結(jié)構(gòu)與算法試卷試題B_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-4/16/0722b31f-022f-49f2-b79c-c670f86ec914/0722b31f-022f-49f2-b79c-c670f86ec9145.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、姓名 學(xué)號(hào) 學(xué)院 專業(yè) 座位號(hào) ( 密 封 線 內(nèi) 不 答 題 )密封線線_ _ 誠(chéng)信應(yīng)考,考試作弊將帶來(lái)嚴(yán)重后果! 華南理工大學(xué)期末考試 Data Structure and Algorithms 試卷B注意事項(xiàng):1. 考前請(qǐng)將密封線內(nèi)填寫(xiě)清楚; 2. 所有答案請(qǐng)直接答在試卷上; 3考試形式:閉卷; 4. 本試卷共十大題,滿分100分,考試時(shí)間120分鐘。題 號(hào)一二三四五六七八九十總分得 分評(píng)卷人1. Select the correct choice. (20 scores, each 2 scores)(3) If a data element requires 6 bytes and
2、a pointer requires 3 bytes, then a standard array representation will be more space efficient than a linked list representation when the fraction of non-null elements is more than about: ( D ) (A) 1/3 (B) 1/2 (C) 3/4 (D) 2/3(5) We use the parent pointer representation for general trees to solve ( C
3、) problem?(A) Shortest paths (B) General tree traversal (C) Determining if two nodes are in the same tree (D) Exact-match query(1) An algorithm must be or do all of the following EXCEPT: ( C )(A) Correct (B) No ambiguous (C) General steps (D) terminate(2) Pick the growth rate that corresponds to the
4、 most efficient algorithm as n gets large: ( A )(A) 100n3logn (B) n4 (C) n! (D) 2n (4) Which statement is not correct among the following four: ( A )(A) The number of empty sub-trees in a non-empty binary tree is one less than the number of nodes in the tree.(B) The Mergesort is a stable sorting alg
5、orithm.(C) A general tree can be transferred to a binary tree with the root having only left child.(D) A sector is the smallest unit of allocation for a record, so all records occupy a multiple of the sector size. (6) The most effective way to reduce the time required by a disk-based program is to:
6、( B ) (A) Improve the basic operations. (B) Minimize the number of disk accesses. (C) Sorting the data of file. (D) Reduce main memory use.(7) In the following sorting algorithms, which is the best one to find the first 10 biggest elements in the 1000 unsorted elements ( D )(A) Insert sort. (B) Shel
7、l sort.(C) Quicksort. (D) Heap sort. (8) Given an array as Amn. Supposed that A00is located at 544(10) and A22is stored at 576(10), and every element occupies one space. “(10)” means that the number is presented in decimals. Then the element A33(10) is at position: ( A )(A) 592 (B) 595 (C) 550 (D) 6
8、08(10) Assume that we have eight records, with key values A to H, and that they are initially placed in alphabetical order. Now, consider the result of applying the following access pattern: F D F G E G F A D F G E if the list is organized by the Move-to-front heuristic, then the final list will be
9、( B ).(A) F G D E A B C H (B) E G F D A B C H(C) A B F D G E C H (D) E G F A C B D H (9) Which queries supported by both of the hashing and tree indexing method ( D ) (A) Range queries. (B) Queries in key order(C) Minimum or maximum queries (D). Exact-match queries2. Fill the blank with correct C+ c
10、odes: (20 scores)(1) Given an array storing integers ordered by distinct value without duplicate, modify the binary search routines to return the position of the integer with the largest value less than K when K itself does not appear in the array. Return ERROR if the least value in the array is gre
11、ater than K: (12 scores)/ Return position of lest element >= Kint newbinary(int array, int n, int K) int l = -1; int r = n; / l and r beyond array bounds while (l+1 != r) / Stop when l and r meet _ int i=(l+r)/2_; / Check middle of remaining subarray if (K < arrayi) _ r=i _; / In left half if
12、(K = arrayi) _ return i _; / Found it if (K > arrayi) _ l=i _ / In right half / K is not in array or the least value in the array is greater than K if K> array0 (or l!=-1)then return l; /the smallest value in the array is not greater than K with l updatedelse return ERROR; / the least value in
13、 the array is greater than K (2) A full 8-ary tree with 100 internal nodes has _701_ leaves. (4 scores)(3) The number of different shapes of binary trees with 6 nodes is _132_. (4 scores)3. Show an acceptable topological sort to a series of jobs with some prerequisites showed as following figure. (4
14、 scores)J1, J3, J2, J6, J4, J5, J74. Show the min-heap that results from running buildheap on the following values stored in an array: 4, 2, 5, 8, 3, 6, 10, 14. (6 scores)44444222555228843528345283465283461052834610145. Trace by hand the execution of Radix-sort algorithm on the array: int a = 265 30
15、1 751 129 937 863 742 694 076 438. (6 scores)initial: 265 301 751 129 937 863 742 694 076 438pass 1: 301 751 742 863 694 265 076 937 438 129pass 2: 301 129 937 438 742 751 863 265 076 694pass 3: 075 129 265 301 438 694 742 751 863 937 final sorted array: 075 129 265 301 438 694 742 751 863 937
16、6. (10 scores) (a) Describe simply the main tasks of the two phases of external sorting. (4 scores)(b). Assume that working memory is 256KB broken into blocks of 8192 bytes (there is also additional space available for I/O buffers, program variables, etc.) What is the expected size for the largest f
17、ile that can be merged using replacement selection followed by two passes of multi-way merge Explain how you got your answer. (6 scores)(a) The task of first phase is to break the files into large initial runs by replacement selection; the second phase is to merge the runs together to form a single
18、sorted run file.(b) Since working memory is 256KB and the blocksize is 8KB, the working memory holds 32 blocks. The expected runlength is 512KB, so a single pass of multiway merge forms runs of length 512KB*32=16MB. The second pass then forms a run as large as 16MB*32=512MB.7. Assume a disk drive is
19、 configured as follows. The total storage is approximately 675M divided among 15 surfaces. Each surface has 612 tracks; there are 144 sectors/track, 512 byte/sector, and 16 sectors/cluster. The interleaving factor is 3. The disk turns at 7200rmp (8.3ms/r). The track-to-track seek time is 20 ms, and
20、the average seek time is 80 ms. Now how long does it take to read all of the data in a 360 KB file on the disk Assume that the files clusters are spread randomly across the disk. A seek must be performed each time the I/O reader moves to a new track. Show your calculations. (The process of your solu
21、tion is required!) (6cores)Answer:The first question is how many clusters the file requires A cluster holds 16*0.5K = 8K. Thus, the file requires 360/8=45clusters. The time to read a cluster is seek time to the cluster+ latency time + (interleaf factor × rotation time).Average seek time is defi
22、ned to be 80 ms. Latency time is 0.5 *8.3, and cluster rotation time is 3 * (16/144)*8.3.Seek time for the total file read time is45* (80 + 0.5 * 8.3+ 3 * (16/144)*8.3 ) = 3911.258. Using closed hashing, with double hashing to resolve collisions, insert the following keys into a hash table of eleven
23、 slots (the slots are numbered 0 through 10). The hash functions to be used are H1 and H2, defined below. You should show the hash table after all eight keys have been inserted. Be sure to indicate how you are using H1 and H2 to do the hashing. ( The process of your solution is required!) H1(k) = 3k
24、 mod 11 H2(k) = 7k mod 10+1 Keys: 22, 41, 53, 46, 30, 13, 1, 67. (10 scores)Answer:H1(22)=0, H1(41)=2, H1(53)=5, H1(46)=6, no conflictWhen H1(30)=2, H2(30)=1 (2+1*1)%11=3,so 30 enters the 3rd slot; H1(13)=6, H2(13)=2 (6+1*2)%11=8, so 13 enters the 8th slot; H1(1)=3, H2(1)=8 (3+5*8)%11= 10 so 1 enter
25、s 10 (pass by 0, 8, 5, 2 );H1(67)=3, H2(67)=10 (3+2*10)%11= 1 so 67 enters 1(pass by 2) 22 67 41 30 53 46 13 1 0 1 2 3 4 5 6 7 8 9 109. (11scores)65312410252015101133 Figure 1 Example graph(1) Draw the adjacency matrix representation and adjacency list representation for the graph of the figure-1. A
26、nd if a pointer requires four bytes, a vertex label requires two bytes, and an edge weight requires two bytes, which representation requires more space for this graph (8 scores)(2) Show the DFS tree for the example graph, starting at Vertex 1. (3 scores)Answer: (1) (a) adjacency matrix (3 scores) 1 2 3 4 5 6-1 | 10 20 2 |2 | 10 3 5 |3 | 3 15 |4 | 20 5 11 10 |5
溫馨提示
- 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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 關(guān)于建房消防合同范例
- 拍賣(mài)行業(yè)市場(chǎng)發(fā)展趨勢(shì)考核試卷
- 具體保險(xiǎn)保險(xiǎn)合同范本
- 衛(wèi)生潔具市場(chǎng)渠道下沉與零售商市場(chǎng)拓展策略考核試卷
- ktv酒水購(gòu)銷(xiāo)合同范本
- 小學(xué)二年級(jí)上-連加連減-數(shù)學(xué)練習(xí)題
- 代采購(gòu)居間合同范本
- 個(gè)人承攬勞務(wù)合同范本
- 加盟酒店合同范本
- 債務(wù)回購(gòu)合同范例
- 休閑農(nóng)業(yè)與鄉(xiāng)村旅游(課件)
- GB/T 19675.2-2005管法蘭用金屬?zèng)_齒板柔性石墨復(fù)合墊片技術(shù)條件
- 社會(huì)工作綜合能力上(初級(jí))課件
- 《數(shù)據(jù)結(jié)構(gòu)》課件(完整版)
- 2023年春節(jié)后建筑施工復(fù)工復(fù)產(chǎn)專項(xiàng)方案
- 污水處理廠化驗(yàn)管理手冊(cè)
- 出納收入支出記賬表Excel模板
- 叉車(chē)操作規(guī)程
- 2021年春新青島版(五四制)科學(xué)四年級(jí)下冊(cè)全冊(cè)教學(xué)課件
- 土建工程技術(shù)標(biāo)范本(DOC167頁(yè))
- 惡性腫瘤化療后重度骨髓抑制病人的護(hù)理論文
評(píng)論
0/150
提交評(píng)論