AlgFall06Comps

# AlgFall06Comps - Algorithms Fall 2006 Graduate...

This preview shows pages 1–3. Sign up to view the full content.

Algorithms Fall 2006 Graduate Comprehensive Exam 1. For two positive integers a , and n , naively computing a n takes multiplying a with itself n- times, i.e., Θ (n) time. Write a divide-and-conquer algorithm for the same purpose. Show your algorithm’s asymptotic time-complexity by setting up the corresponding recurrence equation and solving it. 2a. Explain in a line or two how can one detect in O( n ) time whether an input directed graph is a tree or not, where n is the number of vertices of the graph. 2b. What is the asymptotic time-complexity of the following algorithm-fragment in terms of n. ? (1) For i = 3 through n do (2) For p = 5 through 10 do (3) For k = 3 through i do (4) -constant or O (1) number of steps- end for loops; 2c. What will be the output value of count from line 6 after the following loops are executed? (0) int count := 0; (1) For i =1 through 5 do (2) For p = 1 through i*i do (3) if ( i divides p ) then (4) For k = 1 through i do (5) count++; end for loops; (6) print count ;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3. For a weighted undirected graph
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/10/2012 for the course CSE 5211 taught by Professor Dmitra during the Spring '12 term at FIT.

### Page1 / 3

AlgFall06Comps - Algorithms Fall 2006 Graduate...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online