0% found this document useful (0 votes)
114 views3 pages

S Finsol

This document provides sample problems and solutions for a final exam in an analysis of algorithms course. It includes 5 problems: 1) using the Master Theorem to solve a recurrence relation, 2) using indicator random variables to find the expected number of empty bins from random ball placement, 3) proving or disproving a statement about minimum spanning trees and cuts, 4) proving or disproving a statement about how minimum cuts change with increased edge capacities, and 5) formulating the longest cycle problem as a decision problem and proving it is NP-complete by reducing from Hamiltonian cycle.

Uploaded by

Sachin Michu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views3 pages

S Finsol

This document provides sample problems and solutions for a final exam in an analysis of algorithms course. It includes 5 problems: 1) using the Master Theorem to solve a recurrence relation, 2) using indicator random variables to find the expected number of empty bins from random ball placement, 3) proving or disproving a statement about minimum spanning trees and cuts, 4) proving or disproving a statement about how minimum cuts change with increased edge capacities, and 5) formulating the longest cycle problem as a decision problem and proving it is NP-complete by reducing from Hamiltonian cycle.

Uploaded by

Sachin Michu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS 4120 Analysis of Algorithms A term 2010

Solutions for the Practice Final Exam


These problems are sample problems for the nal exam, so you may expect similar problems in the nal. Do not hand in your solutions. Solutions will be handed out, discussed (and posted on the web) on Tuesday. The nal exam is from the material of the whole course, but there will be only one or two problems from the rst half. The nal exam is a closed book exam, but you may use two sheets of paper (so you may use your midterm sheet) with notes on it. Each problem is worth 20 points. 1. Use the Master Theorem to nd the asymptotic solution for the following recurrence: T (n) = 5T ( n ) + n3 . 2 Solution: We have a = 5, b = 2, f (n)/nlog2 5 = n3 /nlog2 5 , we get Case 3, and thus T (n) = (n3 ). Note that the regularity condition is satised as 5(n/2)3 = 5n3 /8 cn3 for c = 5/8. 2. Use indicator random variables to nd the expected number of bins that remain empty when m balls are distributed into n bins uniformly at random. Solution: Let Xi = 1 if the ith bin remains empty 0 otherwise

Then by the linearity of expectation


n n n

E(X) = E(
i=1

Xi ) =
i=1

E(Xi ) =
i=1

n 1 m (n 1)m ) = . n nm1

3. Prove or give a counterexample: For any graph G with distinct positive weights associated with each edge and for any cut of G, the minimum spanning tree of G contains exactly one edge belonging to the cut. Solution: This is false. Here is a simple counterexample:

Consider the cut ({a, c}, {b, d}). The MST contains both edges of the cut. 4. Prove or give a counterexample: Let G be a ow network with directed edges and positive capacities associated with each edge and let (S, T ) be a minimum cut of the network. If we increase the capacity of every edge in G by 1 the cut (S, T ) is still a minimum cut. Solution: This is false. Here is a simple counterexample:

In this ow network consider two minimum cuts, ({s, a, b}, {c, t}) and ({s, a, b, c}, {t}). Increasing the capacity of every edge by 1 increases the capacity of the rst cut by 2 and the capacity of the second cut by 2

1, so the rst cut is not minimum anymore. (20 points) 5. The longest-cycle problem is the problem of determining a cycle of maximum length in a graph G. Formulate a related decision problem, and show that the decision problem is N P -complete. You may use any of the N P -complete problems learned in class for your reduction. Solution: Here is the corresponding decision problem: CYCLE = {(G, k) : G has a cycle of length k}. First we show that CYCLE is in N P . Suppose we are given a graph G = (V, E) and an integer k. The certicate we choose is the cycle itself. The verication algorithm arms that this is a cycle of length k. To show that the problem is N P -hard, we will show HAM-CYCLE P CYCLE. The reduction takes as input an instance G = (V, E) of the Hamiltonian problem and outputs an instance (G, |V |) of the cycle problem. This is indeed a reduction: the graph G has a Hamiltonian cycle if and only if it has a cycle of length |V |.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy