Question 11
Question 12
Let s and t be two vertices in a undirected graph G + (V, E) having distinct positive edge weights. Let [X, Y] be a partition of V such that s ∈ X and t ∈ Y. Consider the edge e having the minimum weight amongst all those edges that have one vertex in X and one vertex in Y The edge e must definitely belong to:
Question 13
Consider the following dynamic programming code snippet for solving the 0/1 Knapsack problem:
def knapsack(values, weights, capacity, n):
if n == 0 or capacity == 0:
return 0
if weights[n-1] > capacity:
return knapsack(values, weights, capacity, n-1)
else:
return max(values[n-1] + knapsack(values, weights, capacity-weights[n-1], n-1),
knapsack(values, weights, capacity, n-1))
Given the values [60, 100, 120] and weights [10, 20, 30], what would be the output of calling knapsack(values, weights, 50, 3)?
Question 14
Consider the following graph:
[caption width="800"]Graph[/caption]Which edges would be included in the minimum spanning tree using Prim's algorithm starting from vertex A?
Options: a) b) c) d)
Question 15
Let G be a connected undirected graph with n vertices and m edges. Which of the following statements is true regarding the minimum number of edges required to create a cycle in G?
Question 16
Question 17
Given the intervals [(1, 4), (3, 6), (5, 7), (8, 9)], what would be the output of calling a function that solves the Job Scheduling Algorithm?
Question 18
Let G be a complete undirected graph on 4 vertices, having 6 edges with weights being 1, 2, 3, 4, 5, and 6. The maximum possible weight that a minimum weight spanning tree of G can have is.
Question 19
G = (V, E) is an undirected simple graph in which each edge has a distinct weight, and e is a particular edge of G. Which of the following statements about the minimum spanning trees (MSTs) of G is/are TRUE
I. If e is the lightest edge of some cycle in G, then every MST of G includes e II. If e is the heaviest edge of some cycle in G, then every MST of G excludes e
Question 20
There are 22 questions to complete.