0 0 votes Programming in C + – Shadan Karim 1.3k views answer comment Share Follow Print See all 8 Comments 8 8 Comments reply Shubhanshu commented Dec 30, 2018 reply Follow flag Is it $3$? 0 0 replyShare Magma commented Dec 30, 2018 reply Follow flag Yeah 3 0 0 replyShare Shadan Karim commented Dec 30, 2018 reply Follow flag i also got 3 , but the answer given is 4 0 0 replyShare Shubhanshu commented Dec 30, 2018 reply Follow flag Post their provided solution. 0 0 replyShare kumar.dilip commented Dec 30, 2018 reply Follow flag 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. 2 2 replyShare Magma commented Dec 30, 2018 reply Follow flag Nice 1 1 replyShare kumar.dilip commented Dec 30, 2018 reply Follow flag Magma what will be the size of the $stack$ in case of $DFS$ ??? 0 0 replyShare aambazinga commented Jan 2, 2019 reply Follow flag 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. 0 0 replyShare Please log in or register to add a comment.
0 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. Kunal Kadian answered Dec 30, 2018 Kunal Kadian comment Share Follow 0 reply Please log in or register to add a comment.