\documentstyle[11pt]cfw_article
\begincfw_document
\titlecfw_Solutions for Tutorial Sheet 3
\authorcfw_Arindam Pal (arindamp@cse.iitd.ernet.in)
\datecfw_September 22, 2007
\maketitle
\section*cfw_Problem 1
Consider a single phase where $n'$ UNION operatio

Name
CSL 356 Algorithm Design and Analysis
Minor 1, Sem I 2009-10, Max 40, Time 1 hr
Entry No.
Group
Note Every algorithm must be accompanied by proof of correctness, time and space complexity.
You can however quote any result covered in the lectures with

CSL 356, Minor 2 Solutions
1. Negative 1.5 marks for each incorrect answer.
(a) Actually false but True has been accepted since the Universal
family discussed in class satises this property.
(b) True follows from the expected bound.
(c) False We only have

Name
CSL 356 Algorithm Design and Analysis
Major, Sem I 2009-10, Max 80, Time 2 hrs
Entry No.
Group
Note Every algorithm must be accompanied by proof of correctness, time and space complexity.
You can however quote any result covered in the lectures witho

CSL 356 Analysis and Design of Algorithms
Minor II, Sem I 2007-08, Max 40, Time 1 hr
Entry No.
Name
Group
Note (i) Write your answers neatly and precisely. You wont get a second chance to explain what you have written.
(ii) Every algorithm must be accompa

CSL356 Analysis and Design of Algorithms
Quiz 2
Problem: There are n jobs J1 , J2 , . . . , Jn that must be scheduled on a single machine.
Job Ji has processing time ti and a prot pi if it is completed within the deadline di ( and
0 otherwise). Once sched

CSL 356 Algorithm Design and Analysis
Minor II, Sem I 2006-07, Max 40, Time 1 hr
Note (i) In Problem 1, negative 1.5 mark for each incorrect answer.
(ii) Write your answers neatly and precisely. You wont get a second chance to explain what you have writte

CSL 356, Minor 2 Solutions
1. Negative 1.5 marks for each incorrect answer.
(a) Actually false but True has been accepted since the Universal
family discussed in class satises this property.
(b) True follows from the expected bound.
(c) False We only have

Solutions for Tutorial Sheet 3
Arindam Pal (arindamp@cse.iitd.ernet.in)
September 22, 2007
Problem 1
Consider a single phase where n UNION operations are followed by m
FIND operations. UNION operations cost O(1), so after the rst phase
we have some trees

Solutions for Tutorial Sheet 1
Arindam Pal (arindamp@cse.iitd.ernet.in)
February 22, 2014
1
Problem 3
A k -way merge can be done in the following ways.
A. Merge the k sequences pairwise in a binary tree structure. Time
complexity is O(n log k ), since at

CSL 356, Solution to Tutorial Sheet 2
1. Given a binary tree of N leaf nodes, show that the average distance from leaf nodes to the root node
is (log N ) for any binary tree.
Hint: Suppose the minimum tree has x nodes in the left subtree and N x in the ri

CSL 356 Analysis and Design of Algorithms
Quiz I, Sem I 2007-08, Max 20, Time 40 mins
Note (i) Write your answers neatly and precisely. You wont get a second chance to explain what you have written.
(ii)Feel free to quote any result from the lectures with

CSL 356, Class Assignment Sheet
1. Typesetting problem The input is a sequence of n words of lengths l1 , l2 . . . ln measured in
characters. We want to print it nicely on a number of lines that can hold a maximum of M
characters each. The criterion for n

CSL 356, Tutorial Sheet 3
1. Consider the following special case of UNION-FIND. There are three phases where in each phase
all the UNIONS precede the FIND. Can you design a more ecient implementation (than the one
described in class).
2. We are given a se

CSL 356, Tutorial Sheet 2
1. Given a binary tree of N leaf nodes, show that the average distance from leaf nodes to the root node
is (log N ) for any binary tree.
Hint: Suppose the minimum tree has x nodes in the left subtree and N x in the right subtree

CSL 356, Tutorial Sheet 1
1. Solve the following recurrence equations given T (1) = O(1)
(a) T (n) = T (n/2) + bn log n
(b) T (n) = aT (n 1) + bnc
2. Show that the solution to the recurrence X (1) = 1 and
n
X (i)X (n i) for n > 1
X (n) =
i=1
is X (n + 1)

CSL 356, Minor 2 Solutions
1. Negative 1.5 marks for each incorrect answer.
(a) Actually false but True has been accepted since the Universal
family discussed in class satises this property.
(b) True follows from the expected bound.
(c) False We only have

CSL 356 Analysis and Design of Algorithms
Minor I, Sem I 2007-08, Max 40, Time 1 hr
Entry No.
Name
Group
Note (i) Write your answers neatly and precisely. You wont get a second chance to explain what you have written.
(ii) Every algorithm must be accompan