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

Algorithm Design and Analysis Tutorial 2025

The document outlines a tutorial on the design and analysis of algorithms, covering various topics such as matroid theory, divide-and-conquer algorithms for minimum spanning trees, dynamic programming for independent sets and billboard placement, and problems related to the Traveling Salesman Problem and Longest Common Subsequence. It includes specific algorithmic challenges and proofs, along with examples to illustrate the concepts. The tutorial aims to enhance understanding of algorithm design techniques and their applications in solving complex problems.
Copyright
© © All Rights Reserved
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)
41 views3 pages

Algorithm Design and Analysis Tutorial 2025

The document outlines a tutorial on the design and analysis of algorithms, covering various topics such as matroid theory, divide-and-conquer algorithms for minimum spanning trees, dynamic programming for independent sets and billboard placement, and problems related to the Traveling Salesman Problem and Longest Common Subsequence. It includes specific algorithmic challenges and proofs, along with examples to illustrate the concepts. The tutorial aims to enhance understanding of algorithm design techniques and their applications in solving complex problems.
Copyright
© © All Rights Reserved
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

Tutorial 4, Design and Analysis of Algorithms, 2025

1. Prove that if (S; I ) is a matroid, then (S; I 0 ) is a matroid, where

I
0 = f A0 j S 0 contains some maximal A 2 I g:
A

That is, the maximal independent sets of (S; I 0 ) are just the complements of the
maximal independent sets of (S; I ).
2. Professor Borden proposes a new divide-and-conquer algorithm for computing
minimum spanning trees, which goes as follows. Given a graph G = (V ; E ), parti-
tion the set V of vertices into two sets V1 and V2 such that jV1 j and jV2 j di er by at
most 1. Let E1 be the set of edges that are incident only on vertices in V1 , and let
E2 be the set of edges that are incident only on vertices in V2 . Recursively solve

a minimum-spanning-tree problem on each of the two subgraphs G1 = (V1 ; E1 )


and G2 = (V2 ; E2 ). Finally, select the minimum-weight edge in E that crosses the
cut (V1 ; V2 ), and use this edge to unite the resulting two minimum spanning trees
into a single spanning tree. Either argue that the algorithm correctly computes
a minimum spanning tree of G, or provide an example for which the algorithm
fails.
3. Show how to transform the weight function of a weighted matroid problem, where
the desired optimal solution is a minimum-weight maximal independent subset,
to make it a standard weighted-matroid problem. Argue carefully that your trans-
formation is correct.
4. We are looking at the price of a given stock over n consecutive days, numbered
i = 1; 2; :::; n. For each day i, we have a price p(i) per share for the stock on

that day. (We will assume for simplicity that the price was xed during each
day.) We would like to know: How should we choose a day i on which to buy
the stock and a later day j > i on which to sell it, if we want to maximize the
pro t per share, p(j ) p(i)? (If there is no way to make money during the n
days, we should conclude this instead). Design an ecient algorithm to nd the
optimal numbers i and j in time O(n). Show the working of your algorithm on
the following problem instances:
(p(i))10
i=1
= (83; 18; 34; 2; 71; 26; 44; 46; 48; 75)
(p(i))i=1 = (83; 75; 71; 48; 46; 44; 34; 26; 18; 2)
10

5. Let G = (V ; E ) be an undirected graph with n nodes. Recall that a subset of


the nodes is called an independent set if no two of them are joined by an edge.
Finding large independent sets is dicult in general; but here we will see that it
can be done eciently if the graph is \simple" enough. Call a graph G = (V ; E )
a path if its nodes can be written as v1 ; v2 ; : : : ; vn , with an edge between vi and
vj if and only if the numbers i and j di er by exactly 1. With each node vi , we

1
associate a positive integer weight wi . Consider, for example, the ve-node path
drawn in Figure 1. The weights are the numbers drawn inside the nodes. The
goal in this question is to solve the following problem:
Find an independent set in a path G whose total weight is as large as possible.
Design an ecient Dynamic Programming algorithm that takes an n-node path
G with weights and returns an independent set of maximum total weight. The

running time of your algorithm should be polynomial in n, independent of the


values of the weights. Give a formal correctness proof for your algorithm. Find
the time complexity of your algorithm and show its working on the given example
(Figure 1).

Figure 1: A path with weights on the nodes. The maximum weight of an independent set is 14.

6. Suppose you are managing the construction of billboards on a Highway that runs
for M miles. The possible sites for billboards are given by numbers f x1 ; x2 ; : : : ; xn g,
each in the interval [0; M ]. If you place a billboard at location xi , you receive a
revenue of ri > 0. Regulations imposed by the Highway Department require that
no two of the billboards be within less than or equal to 5 miles of each other.
You have to place billboards at a subset of the sites so as to maximize your total
revenue, subject to this restriction.
Example: Suppose M = 20; n = 4,
fx1; x2; x3; x4g = f6; 7; 12; 14g, and
fr1; r2; r3; r4g = f5; 6; 5; 1g.
Then the optimal solution would be to place billboards at x1 and x3 , for a total
revenue of 10. Design an ecient Dynamic Programming algorithm that takes
an instance of this problem as input and returns the maximum total revenue that
can be obtained from any valid subset of sites. The running time of the algo-
rithm should be polynomial in n. Show the working of your algorithm on the
given example.
7. Find all possible shortest salesman tours and cost for the following instance of
the Traveling Salseman Problem for a directed K4 graph having the following
adjacency matrix: 2 3
0 5 3 8
669 0 4 177
66 7:
45 8 0 475
7 2 6 0
8. Determine a Longest Common Subsequence of < 1; 1; 0; 1; 1; 1; 0; 1; 0; 0 > and <

0; 0; 0; 1; 1; 0; 1; 1; 0; 0; 1 > using the Dynamic Programming Algorithm.

2
9. Solve the following instance of the Matrix Chain Multiplication Problem:
< A32 ; B24 ; C45 ; D52 ; E21 ; F16 >.

10. Prove that the number of di erent binary trees with n nodes is
!
1 2n
:
n+1 n

You might also like