# 610 2.pdf - CS PhD Qualifying Exam, Summer 2008 Data Struct...

• 2

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 2 pages.

CS PhD Qualifying Exam, Summer 2008Data Struct & Algorithms (CS 610)Answer ALL 5 problems, each worth 20 points.Note: Be concise in describing your algorithms. If you use a known algorithm, then you can use itas a black-box (subroutine) without going into details of how that known algorithm works. Avoiduseless rambling about known algorithms, as that is viewed negatively!Definition (Little oh):We sayT(n) iso(f(n)), or sayT(n) isasymptotically lowerthanf(n),if:limn→∞T(n)f(n)= 0.For example, logniso(n), butn/2 is noto(n).1. You are given twosortedsequencesAandBof lengthnandn2respectively. We want tofind a sorted sequenceCthat contains those elements that arecommonto bothAandB.For example, ifA= (2,5,9) andB= (1,2,3,4,6,7,8,9,10) thenC= (2,9).Describe anasymptotically best algorithm for this task. Analyze its worst-case time complexity.2. We define a Binary-Search-Tree (BST) withnnodes to bebalancedif its height isO(logn).For example, AVL trees and red-blank trees are balanced.We have two arbitrary (not necessarily balanced) binary-search-treesT1andT2withn1andn2nodes,n=n1+n2. Assume alln

Course Hero member to access this document

End of preview. Want to read all 2 pages?