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

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
**Unformatted text preview: **CSE5311 Design and Analysis of Algorithms Exercise Problems 2 09/09/09 1. You are given a list of numbers for which you need to construct a min-heap. (A Min-heap is a binary tree in which every key is less than or equal to the keys in its children.) Write a min-heap algorithm and analyze its complexity. 2. Explain how we can check a graph’s cyclicity by using Breadth-first search. Does either of the two traversals – DFS or BFS –always find a cycle faster than the other? If your answer is yes, indicate which of them is better and explain why it is the case; if you answer no, give two examples supporting your answer. 3. Let G = (V,E) be an (undirected) graph with costs c e ≥ 0 on the edges e ∈ E . Assume you are given a minimum-cost spanning tree T in G . Now assume that a new edge is added to G , connecting two nodes v, w ∈ V with cost c . a. Give an efficient algorithm to test if T remains the minimum-cost spanning tree with the new edge added to G (but not to the tree T ). Make your algorithm run in time O ( E ). Can you do it in O( V ) time?...

View
Full
Document