Noc20-Cs27 Week 03 Assignment 01
Noc20-Cs27 Week 03 Assignment 01
Noc20-Cs27 Week 03 Assignment 01
(https://swayam.gov.in) (https://swayam.gov.in/nc_details/NPTEL)
Course
outline Week 3 Quiz
How does an The due date for submitting this assignment has passed. Due on 2020-02-19, 23:59 IST.
NPTEL online As per our records you have not submitted this assignment.
course work?
All questions carry equal weightage. You may submit as many times as you like within the deadline.
Week 1 : Your final submission will be graded.
Introduction
1) An undirected graph G on 30 vertices has 4 connected components. What is the minimum 2 points
number of edges in G?
Week 1 : Analysis
of algorithms 29
25
Week 1 Quiz
26
O(m)
https://onlinecourses.nptel.ac.in/noc20_cs27/unit?unit=101&assessment=102 1/4
02/07/2020 Design and analysis of algorithms - - Unit 9 - Week 3 Quiz
Week 3 O(n + m)
Programming O(n2)
Assignment O(n2 + m)
No, the answer is incorrect.
Week 4 : Score: 0
Weighted graphs Feedback:
We can do it in O(n+m) as follows. Initialize in(u) to empty for each u in V (time O(n)). For each v in V, scan
Week 4 Quiz out(v) and for each j in out(v), add v to in(j) (time O(m) across all V).
Accepted Answers:
Week 4 O(n + m)
Programming
Assignment 3) Suppose we obtain the following DFS tree rooted at node D for an undirected graph Gr with 2 points
vertices {A,B,C,D,E,F,G,H}.
Week 5: Data
Structures:
Union-Find and
Heaps
Week 5 : Divide
and Conqure
Week 5 Quiz Which of the following cannot be an edge in the graph Gr?
4) We are interested in topological orderings of the following DAG that satisfy one or both of the 2 points
Week 7: Dynamic following constraints:
Programming
4 appears before 3
8 appears after 7
Week 7 Quiz
How many such orderings are there?
Week 7
Programming
Assignment
Week 8: Linear
Programming
and Network
Flows 18
16
Week 8:
6
Intractability
2
Week 8 Quiz No, the answer is incorrect.
Score: 0
Text Transcripts Feedback:
https://onlinecourses.nptel.ac.in/noc20_cs27/unit?unit=101&assessment=102 2/4
02/07/2020 Design and analysis of algorithms - - Unit 9 - Week 3 Quiz
Any topological sort is of the form 1, followed by a topological ordering of {2,3,4,5}, followed by 6, followed
Books by a topological ordering {7,8,9}.
Nodes {2,3,4,5} have (4 choose 2) = 6 topological orderings of which only one, 2-3-4-5 has 3 before 4. All
Download Videos
other orderings have 4 before 3: 2-4-3-5, 2-4-5-3, 4-2-3-5, 4-2-5-3, 4-5-2-3..
Nodes {7,8.9} have 3 topological orderings, 7-8-9, 8-7-9, 8-9-7, of which two have 8 before 7 and one has 8
after 7.
There are 6 × 3 = 18 total topological orderings of which 1 × 2 = 2 violates both conditions, so 16 satisfy
one condition or both.
Accepted Answers:
16
5) Finishing the interiors of a lecture hall consists of several steps, such as laying electrical 2 points
cables, installing audio-visual equipment, attaching the blackboard, etc. Suppose there are 10 steps,
labelled A, B, C, D, E, F, G, H, I, J. Each step takes a day to complete and we have the following
dependencies between steps.
A must happen before J
B must happen before D
B must happen before G
C must happen before B
D must happen before A
D must happen before E
E must happen before J
F must happen before C
G must happen before D
H must happen before F
H must happen before I
I must happen before B
I must happen before G
9
8
7
6
No, the answer is incorrect.
Score: 0
Feedback:
Here is the corresponding dag, whose longest path, for instance H-F-C-B-G-D-A-J, has length 8.
Accepted Answers:
8
https://onlinecourses.nptel.ac.in/noc20_cs27/unit?unit=101&assessment=102 3/4
02/07/2020 Design and analysis of algorithms - - Unit 9 - Week 3 Quiz
https://onlinecourses.nptel.ac.in/noc20_cs27/unit?unit=101&assessment=102 4/4