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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!