Department of Computer Science Graduate Comprehensive Exam in Computer Science Spring 2001 Directions: Answer the questions on the paper supplied. Answer question 1. Answer question 2. Answer question 3. Start each question on a new page. Write on only one side of the paper. Write your SSN in the top right corner of each page of your answer. Do NOT put your name anywhere on the answers. Put the number of the question being answered in the top left corner of each page of your answer. If the answer to a question is written on more than one page, number the pages consecutively. 1. CS5329 Algorithm Design and Analysis a. State and solve a recurrence relation for the running time of the following algorithm: // given an array A indexed from l to r, l <= r, // and containing elements that can be compared, // rec-max(A,l,r) returns the maximum element in A[l..r]. rec-max(A,l,r) if (l == r) return A[l]; m = rec-max(A,l+1,r); if (A[l] >= m) return A[l] else return m; b. Discuss one of the following algorithms: mergesort, heapsort, or quicksort. A complete answer will include a statement of the problem solved by the algorithm, any special characteristics of the algorithm, discussion of space and time requirements, an example of the way the algorithm works, and a discussion of the design technique(s) (for example, divideand-conquer or dynamic programming) embodied by the algorithm. 2. CS 5391 Survey of Software Engineering What affect does the choice of life cycle model have on the design process? Describe how the design process works within the various life cycle models (linear sequential, prototyping, incremental, spiral). How does the choice of life cycle model affect the software testing process? What is the relationship between life cycle models and the capability maturity model? 3. CS 5346: Advanced Artificial Intelligence a. Explain forward chaining and backward chaining in detail with examples. b. The following general rules are followed in digital circuits. Rules 4-6 cover either ‘ON’ or ‘OFF’ states of the gates. Add three more rules to cover both ‘ON’ and ‘OFF’ states. 1. If two terminals are connected, then they have the same signal: t1, t2 Connected(t1, t2) Signal(t1) = Signal(t2) 2. The signal at every terminal is either on or off (but not both): t Signal(t) = On Signal(t) = Off On Off 3. Connected is a commutative predicate: t1, t2 Connected(t1, t2) Connected(t2, t1) 4. An OR gate’s output is on if and only if any of its inputs are on: g Type(g) = OR Signal(Out(1, g)) = On n Signal (In(n, g)) = On 5. An AND gate’s output is off if and only if any of its inputs are off: g Type(g) = AND Signal(Out(1, g)) = Off n Signal (In(n, g)) = Off 6. An XOR gate’s output is on if and only if its inputs are different: g Type(g) = XOR Signal(Out(1, g)) = On Signal (In(1, g)) Signal (In(2, g)) 7. A NOT gate’s output is different from its input: g (Type(g) = NOT) Signal (Out(1, g)) Signal (In(1, g)) The following is the description of the gate types of the circuit R1 given below: Type (X1) = OR Type (X3) = AND A B Type (X2) = AND Type (X4) = NOT Circuit R1 X1 X3 X2 S X4 C Represent the connections of the circuit and determine what combinations of Sig (In(A, R1)), Sig (In(B, R1)) would cause the following output: (OUT(S, R1) = OFF) (OUT(C, R1) = ON)