Daa 3
Daa 3
A polynomial-time reduction proves that the first problem is no more difficult than
the second one, because whenever an efficient algorithm exists for the second
problem, one exists for the first problem as well. By contraposition, if no efficient
algorithm exists for the first problem, none exists for the second either. Polynomial-
time reductions are frequently used in complexity theory for defining both complexity
classes and complete problems for those classes.
Some real-life problems like the flow of liquids through pipes, the current through
wires and delivery of goods can be modeled using flow networks.
2. There are two distinguishing points, the source s, and the sink t;
Let G = (V, E) be a flow network. Let s be the source of the network, and let t be the
sink. A flow in G is a real-valued function f: V x V→R such that the following
properties hold:
Flow network showing capacities and flows. An edge labeled x / yx/y has flow xx and capacity yy
The quantity f (u, v), which can be positive or negative, is known as the net flow from
vertex u to vertex v. In the maximum-flow problem, we are given a flow network G
with source s and sink t, and we wish to find a flow of maximum value from s to t.
1. Capacity Constraint makes sure that the flow through each edge is not greater
than the capacity.
2. Skew Symmetry means that the flow from u to v is the negative of the flow from v
to u.
3. The flow-conservation property says that the total net flow out of a vertex other
than the source or sink is 0. In other words, the amount of flow into a v is the
same as the amount of flow out of v for every vertex v ∈ V - {s, t}
9. What do you mean by approximation ratio of an
Approximation algorithm?
The approximation ratio (or approximation factor) of an algorithm is the ratio
between the result obtained by the algorithm and the optimal cost or profit. Typically
this ratio is taken in whichever direction makes it bigger than one;
for example, an algorithm that solves for a cost of $2 an instance of a problem that has
an optimal cost of $1 has approximation ratio 2;but an algorithm that sells 10 airplane
tickets (a profit of 10) when the optimum is 20 also has approximation ratio 2.
• For the traveling salesperson problem, the optimization problem is to find the
shortest cycle, and the approximation problem is to find a short cycle.
• For the vertex cover problem, the optimization problem is to find the vertex cover
with fewest vertices, and the approximation problem is to find the vertex cover
with few vertices.
Randomized Algorithm
When utilizing a randomized method, keep the following two considerations in mind:
• It takes source of random numbers and makes random choices during execution
along with the input.
For example, in Randomized Quick Sort, we use a random number to pick the next
pivot (or we randomly shuffle the array). And in Karger’s algorithm, we randomly
pick an edge.