Question 1
The following are the starting and ending times of activities A, B, C, D, E, F, G and H respectively in chronological order: "a
s
b
s
c
s
a
e
d
s
c
e
e
s
f
s
b
e
d
e
g
s
e
e
f
e
h
s
g
e
h
e
" Here, x
s
denotes the starting time and x
e
denotes the ending time of activity X. W need to schedule the activities in a set of rooms available to us. An activity can be scheduled in a room only if the room is reserved for the activity for its entire duration. What is the minimum number of rooms required ?
3
4
5
6
Question 2
Let G be a simple undirected graph. Let TD be a depth first search tree of G. Let TB be a breadth first search tree of G. Consider the following statements. (I) No edge of G is a cross edge with respect to TD. (A cross edge in G is between two nodes neither of which is an ancestor of the other in TD). (II) For every edge (u, v) of G, if u is at depth i and v is at depth j in TB, then ∣i − j∣ = 1. Which of the statements above must necessarily be true?
I only
II only
Both I and II
Neither I nor II
Question 3
An articulation point in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components.
Let T be a DFS tree obtained by doing DFS in a connected undirected graph G. Which of the following options is/are correct?
Root of T can never be an articulation point in G.
Root of T is an articulation point in G if and only if it has 2 or more children.
A leaf of T can be an articulation point in G.
If u is an articulation point in G such that x is an ancestor of u in T and y is a descendent of u in T, then all paths from x to y in G must pass through u.
Question 4
In an adjacency list representation of an undirected simple graph G = (V, E), each edge (u, v) has two adjacency list entries: [v] in the adjacency list of u, and [u] in the adjacency list of v. These are called twins of each other. A twin pointer is a pointer from an adjacency list entry to its twin. If |E| = m and |V | = n, and the memory size is not a constraint, what is the time complexity of the most efficient algorithm to set the twin pointer in each entry in each adjacency list?
Θ(n2)
Θ(m+n)
Θ(m2)
Θ(n4)
Question 5
Let G be an undirected graph. Consider a depth-first traversal of G, and let T be the resulting depth-first search tree. Let u be a vertex in G and let v be the first new (unvisited) vertex visited after visiting u in the traversal. Which of the following statements is always true?
{u,v} must be an edge in G, and u is a descendant of v in T
{u,v} must be an edge in G, and v is a descendant of u in T
If {u,v} is not an edge in G then u is a leaf in T
If {u,v} is not an edge in G then u and v must have the same parent in T
Question 6
Suppose depth first search is executed on the graph below starting at some unknown vertex. Assume that a recursive call to visit a vertex is made only after first checking that the vertex has not been visited earlier. Then the maximum possible recursion depth (including the initial call) is _________.
17
18
19
20
Question 7
Consider the tree arcs of a BFS traversal from a source node W in an unweighted, connected, undirected graph. The tree T formed by the tree arcs is a data structure for computing.
the shortest path between every pair of vertices.
the shortest path from W to every vertex in the graph.
the shortest paths from W to only those nodes that are leaves of T.
the longest path in the graph
Question 8
Let G be a graph with n vertices and m edges. What is the tightest upper bound on the running time on Depth First Search of G? Assume that the graph is represented using adjacency matrix.
O(n)
O(m+n)
O(n2)
O(mn)
Question 9
Let G = (V, E) be a simple undirected graph, and s be a particular vertex in it called the source. For x ∈ V, let d(x) denote the shortest distance in G from s to x. A breadth first search (BFS) is performed starting at s. Let T be the resultant BFS tree. If (u, v) is an edge of G that is not in T, then which one of the following CANNOT be the value of d(u) – d(v)?
-1
0
1
2
Question 10
Let G(V, E) an undirected graph with positive edge weights. Dijkstra's single-source shortest path algorithm can be implemented using the binary heap data structure with time complexity:
O(| V |2)
O (| E | + | V | log | V |)
O (| V | log | V |)
O ((| E | + | V |) log | V |)
There are 25 questions to complete.