Programming Data Structure And Algorithms Using Python | Week 6
Session: JAN-APR 2023
Course Name: Programming Data Structure And Algorithms Using Python
Course Link: Click Here
These are Programming Data Structure And Algorithms Assignment 6 Answers
Quiz
Q1. Suppose u and v both denote sets in Python. Under what condition can we guarantee that u-(u-v) == v?
a. The sets u and v should be disjoint.
b. The set u should be a subset of the set v
c. The set v should be a subset of the set u
d. This is true for any u and v.
Answer: c. The set v should be a subset of the set u
Q2. Suppose u and v both denote sets in Python. Under what condition can we guarantee that u|v == u^v?
a. The sets u and v should be disjoint.
b. The set v should be a subset of the set u.
c. The set u should be a subset of the set v.
d. This is true for any u and v.
Answer: a. The sets u and v should be disjoint.
These are Programming Data Structure And Algorithms Assignment 6 Answers
Q3. Which of the following does not correspond to a max-heap on the list of values [19, 28, 29, 31, 31, 45, 55, 72, 83, 97]?
a. [97, 83, 45, 55, 72, 28, 31, 19, 31, 29]
b. [97, 55, 83, 29, 45, 72, 31, 19, 31, 28]
c. [97, 83, 55, 72, 31, 45, 29, 19, 31, 28]
d. [97, 55, 83, 45, 29, 72, 31, 19, 31, 28]
Answer: b. [97, 55, 83, 29, 45, 72, 31, 19, 31, 28]
Q4. Consider the max-heap [96, 96, 55, 74, 37, 42, 29, 18, 31, 19]. Suppose we apply the operation delete_max() twice to this max-heap. The resulting max-heap is:
a. [74, 37, 55, 19, 31, 42, 29, 18]
b. [74, 37, 55, 31, 19, 29, 42, 18]
c. [74, 37, 55, 31, 18, 42, 29, 19]
d. [74, 37, 55, 31, 19, 42, 29, 18]
Answer: d. [74, 37, 55, 31, 19, 42, 29, 18]
These are Programming Data Structure And Algorithms Assignment 6 Answers
More Weeks of Programming Data Structure And Algorithms: Click Here
More Nptel courses: https://progiez.com/nptel
Session: JULY-DEC 2022
Course Name: Programming Data Structure And Algorithms Using Python
Link of Course: Click Here
These are Programming Data Structure And Algorithms Assignment 6 Answers
Q1. Suppose u and v both have values of type set and are disjoint. Which of the following expressions evaluates to True?
a. u == v | (u^v)
b. u == (v^u)
c. u == v^(u | v)
d. u == u^(v | u)
Answer: c
Q2. Suppose u and v both denote sets in Python. What is the most general condition that guarantees that u|v = uv?
a. The sets u and v should be disjoint.
b. The set u should be a subset of the set v.
c. The set v should be a subset of the set u.
d. This is true for any u and v.
Answer: a
These are Programming Data Structure And Algorithms Assignment 6 Answers
Q3. Consider the min-heap [15, 27, 33, 39, 66, 39, 47, 58, 51]. built by repeatedly inserting values into an empty heap. Which of the following could not have been the last element inserted into this heap?
a. 27
d. 15
c. 58
d. 51
Answer: c
Q4. Suppose we execute delete-min twice on the min-heap [13,29,24,67,52,89,45,98.79,58]. What is the resulting heap?
Answer: [29, 52, 45, 67, 79, 89, 58, 98]
These are Programming Data Structure And Algorithms Assignment 6 Answers
More NPTEL Solutions: https://progiez.com/nptel
* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first. COPYING MATERIALS IS STRICTLY PROHIBITED.
More from PROGIEZ
