0 votes
67 views

asked | 67 views
0
Is it $3$?
0
Yeah 3
0
i also got 3 , but the answer given is 4
0
Post their provided solution.
+2
here not given which node have to choose. I think we have to go to the worst case.

When we select the node E, or B, C , G, or F node.

Then size will be 4.
+1
Nice
0

what will be the size of the $stack$ in case of $DFS$ ???

0
if considering the worst case, then the minimum size should be 5.

if starting from node C, first enqueue B,E,G,D. then dequeue B and enqueue all it's neighbour. so queue will now look like.. E,C,G,D,A,F. this is the maximum elements possible at one time in the queue. isn't it?

please correct me if i'm wrong.

## 1 Answer

0 votes

Well in worst case answer will be 4

If you start bfs from E, ans will be 4. So a min. Queue size of 4 is reqd. With a queue of size 3, you can't do bfs from E.

answered by Active (2.7k points)

0 votes
0 answers
1
0 votes
0 answers
2
0 votes
0 answers
3
+1 vote
1 answer
4
0 votes
1 answer
5
0 votes
0 answers
6
0 votes
0 answers
7