Programming Data Structure And Algorithms Using Python | Week 6

Session: JULY-DEC 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 have values of type set and are disjoint. Which of the following expressions evaluates to True?
u == v | (u^v)
u == (v^u)
u == v^(u | v)
u == u^(v | u)

Answer: u == v^(u | v)


Q2. Suppose u and v both denote sets in Python. What is the most general condition that guarantees that u|v == u^v?
The sets u and v should be disjoint.
The set u should be a subset of the set v.
The set v should be a subset of the set u.
This is true for any u and v.

Answer: The sets u and v should be disjoint.


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?
27
15
58
51

Answer: 58


Q4. Consider the min-heap [13, 24, 32, 32, 41, 38, 50, 48, 40] built by repeatedly inserting values into an empty heap. Suppose the last value inserted was 24. What was the heap structure before this value was inserted?
[13, 32, 32, 41, 40, 38, 50, 48]
[13, 41, 32, 40, 32, 38, 50, 48]
[13, 32, 32, 48, 41, 38, 50, 40]
[13, 32, 32, 40, 41, 38, 50, 48]

Answer: [13, 32, 32, 40, 41, 38, 50, 48]

See also  Programming DSA using Python Nptel Week 2 Assignment Answers

These are Programming Data Structure And Algorithms Assignment 6 Answers


More Weeks of Programming Data Structure And Algorithms Using Python: Click here

More Nptel Courses: Click here


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]

See also  Programming DSA using Python Nptel Week 4 Assignment Answers

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

See also  Programming Data Structure And Algorithms Using Python | Week 4

Answer: c


These are Programming Data Structure And Algorithms Assignment 6 Answers


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


These are Programming Data Structure And Algorithms Assignment 6 Answers