Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 2 : 1, 2, 3, 4, 5, 6

Advertisement

Detailed Solution

सही उत्तर 1, 2, 3, 4, 5, 6 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

Consider the undirected graph with adjacency lists 1:{2,3}, 2:{1,4,5}, 3:{1,6}, 4:{2}, 5:{2,6}, 6:{3,5}. What is the BFS order starting from vertex 1, visiting neighbours in increasing order? / अनिर्देशित ग्राफ जिसकी आसन्नता सूचियाँ 1:{2,3}, 2:{1,4,5}, 3:{1,6}, 4:{2}, 5:{2,6}, 6:{3,5} हैं, में शीर्ष 1 से शुरू करके पड़ोसियों को बढ़ते क्रम में देखते हुए BFS क्रम क्या है?

1.
1, 2, 4, 5, 3, 6
2.
1, 2, 3, 4, 5, 6
3.
1, 3, 2, 6, 5, 4
4.
1, 2, 3, 6, 5, 4

Correct Answer: 1, 2, 3, 4, 5, 6

BFS visits level by level: start 1, then its neighbours 2 and 3, then the unvisited neighbours of 2 (4, 5) and of 3 (6), giving 1, 2, 3, 4, 5, 6. / BFS स्तर-दर-स्तर देखता है: पहले 1, फिर उसके पड़ोसी 2 और 3, फिर 2 के अदेखे पड़ोसी (4, 5) और 3 का (6), अतः 1, 2, 3, 4, 5, 6।

Downloaded from PrepSnap (prepsnap.in)