Professional Documents
Culture Documents
Unit 17 - Week 5 Quiz
Unit 17 - Week 5 Quiz
reviewer3@nptel.iitm.ac.in ▼
Unit 17 - Week
5 Quiz
Course
outline
Week 5 Quiz
The due date for submitting this assignment has passed.
How to access As per our records you have not submitted this Due on 2018-10-03, 23:59 IST.
the portal assignment.
Week 1: All questions carry equal weightage. You may submit as many times as you like within the
Introduction deadline. Your final submission will be graded.
Week 1: 1) Suppose we want to extend the union-find data structure to support the operation 2 points
Analysis of Reset(c), which takes as input the name of a component c and then breaks up c into singleton
algorithms components, like MakeUnionFind(). For instance if c = 3 and c currently consists of {1,3,7}, then
Reset(c) will produce three components called 1, 3 and 7 consisting of {1}, {3} and {7}, respectively.
Week 1 Quiz
Which of the following is correct about the cost of adding Reset(c) to the array and pointer
implementations of union-find discussed in the lecture?
Week 2:
Searching and
sorting Array representation: O(size(c)), Pointer representation: O(size(c))
2) In the algorithm presented for the closest pair of points problem, we have assumed that no 2 points
Week 4 Quiz two points have the same x or y coordinate. Which of the following steps would become more
complicated to justify without this assumption.
Week 4
Funded by
Week 7: Strategy 1 takes time O(n) and Strategy 2 takes time O(log n)
Dynamic
Programming Strategy 1 takes time O(log n) and Strategy 2 takes time O(n)
Strategy 1 takes time O(n) and Strategy 2 takes time O(n log n)
Week 7 Quiz
Strategy 1 takes time O(n log n) and Strategy 2 takes time O(n)
Week 7
Programming No, the answer is incorrect.
Assignment Score: 0
Feedback:
Week 8: Linear
Compressing the array and heapify both take time O(n), so Strategy 1 takes time O(n). Look up the max
Programming
and Network value in a heap takes time O(1). Updating the node takes time O(log n), and so does delete_max(). So the
Flows second strategy takes time O(log n).
Accepted Answers:
Week 8: Strategy 1 takes time O(n) and Strategy 2 takes time O(log n)
Intractability
4) Suppose we want to support the operations predecessor and successor in a heap. Given 2 points
Week 8 Quiz a value v in the heap, pred(v) tells us the next smaller value currently in the heap and succ(v) tells us
the next larger value currently in the heap.
TEXT
TRANSLATION In both min heaps and max heaps, both operations take time O(n).
In both min heaps and max heaps, both operations take time O(log n).
In a min heap, pred(v) takes time O(log n) and succ(v) takes O(n) whereas in a max heap
pred(v) takes time O(n) and succ(v) takes O(log n).
In a min heap, pred(v) takes time O(n) and succ(v) takes O(log n) whereas in a max heap
pred(v) takes time O(log n) and succ(v) takes O(n).
5) Suppose we do merge sort with a five-way split: divide the array into 5 equal parts, sort 2 points
each part and do a 5 way merge. What would the worst-case complexity of this version be?
O(n2)
O(n2 log5n)
O(n log2n)
O(n (log2n)2)
End