高普考題庫
94 年 094年公務人員高等考試三級考試暨普通考試第二試

資料結構(包括資料庫)

本卷皆為申論題,點「看答案與解析」查看擬答。

申論 1給定下列資料鍵值:Jane,Carrie,Bob,Dean,Ken,Sam,Rose,Apple,Mandy,Ted,Victor:(每小題5 分,共20 分)㈠依上述次序建立一二元搜尋樹(Binary search tree)。㈡標出搜尋到“Rose”前所拜訪的所有節點。㈢列出以前序追蹤法(Preorder traversal)拜訪本樹的結果。㈣畫出去除節點“Sam”之後的樹狀。
申論 2設關聯式資料庫(Relational database)中表格(Table)“Lots”之綱要(Schema)如下:Property_ID Country_name Lot# Area Price Tax_rate其中,Property_ID 為主鍵(Primary key),而{Country_name, Lot#}為一候選組合鍵(Candidate composite key),另外本綱要存有如下兩組功能相依關係(Functionaldependency):fd1: Country_name-->Tax_rate;fd2: Area-->Price㈠說明廣義式第三正規式(General definition of third normal form)的意義。(5 分)㈡說明表格“Lots”如何違背上述定義。(5 分)㈢將表格“Lots”轉化成廣義式第三正規式表格。(10 分)
申論 3㈠說明環狀佇列(Circular Queue)的特性。(5 分)㈡設以鏈結串列(linked list)實作一環狀佇列,分別以虛擬碼(Pseudo-code)寫出enqueue 運算子(儲存一資料到佇列),dequeue 運算子(從佇列中去除一給定資料),以及retrieve 運算子(在佇列內搜尋出一給定資料)等演算法。(15 分)
申論 4舉例說明下列與資料庫系統相關的完整性規範(Integrity constraint ):(每小題5 分,共20 分)㈠鍵值完整性規範(Key integrity constraint)。㈡個體完整性規範(Entity integrity constraint)。㈢參考完整性規範(Referential integrity constraint)。㈣語意完整性規範(Semantic integrity constraint)。
申論 5㈠以虛擬碼寫出計算費氏數(Fibonacci number)的遞迴(Recursive)演算法(說明:在以“F=0, F=1”兩費氏數為首的費氏數列(Fibonacci sequence)中,任一費氏數均為前兩費氏數的和)。(10 分)㈡以堆疊(Stack )方式畫出上述演算法在求費氏數為“8” 的遞迴呼叫軌跡(Recursive call trace)。(10 分)