Question
1. Consider DFS, implemented using the generic traversal algorithm, with a stack for A: put s in A while A is not empty do take
1.
Consider DFS, implemented using the generic traversal algorithm, with a stack for A: put s in A while A is not empty do take a node u from A if u is not marked "explored" then mark "u" explored for each edge (u, v) put v in A
Consider a graph with 2n vertices A1, A2, ... An, B1, B2, ... Bn, having all possible edges of the form (Ai, Bj). Which of the following is the best approximation for the maximum stack size, as n grows very large? Assume neighbors are explored in increasing order of their indices.
Select one:
a. 2n22n2
b. 2n2n
c. n2/2n2/2
d. nlognnlogn
e. n2
2.
Consider BFS, implemented using the generic traversal algorithm, with a queue for A: put s in A while A is not empty do take a node u from A if u is not marked "explored" then mark "u" explored for each edge (u, v) put v in A
Consider a graph with 2n vertices A1, A2, ... An, B1, B2, ... Bn, having all possible edges of the form (Ai, Bj). Which of the following describes the worst-case asymptotic growth maximum queue size? Assume neighbors are explored in increasing order of their indices.
Select one:
a. (n^1.5)
b. (n)
c. (n^2)
d. (nlogn)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started