10 votes 10 votes Which of the following data structure is useful in traversing a given graph by breadth first search? Stack Queue List None of the above Algorithms isro2017 data-structures graph-algorithms breadth-first-search easy + – Arjun asked May 9, 2017 Arjun 13.1k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply venkat_sirvisetti commented May 10, 2017 reply Follow Share But sir, both queue and list can be used for performing BFS. –1 votes –1 votes Devshree Dubey commented May 10, 2017 reply Follow Share @Sir Arjun, D Graph being a Directed, With Loops, A simple one or Non Directed???. :D :) 0 votes 0 votes Please log in or register to add a comment.
Best answer 15 votes 15 votes Breadth-first search uses a Queue data structure. https://en.wikipedia.org/wiki/Breadth-first_search#More_details nitish answered May 10, 2017 selected May 10, 2017 by ManojK nitish comment Share Follow See all 3 Comments See all 3 3 Comments reply venkat_sirvisetti commented May 10, 2017 reply Follow Share But a list can also be used to implement BFS efficiently. We can list to design a queue 0 votes 0 votes Prashant. commented May 10, 2017 reply Follow Share when multiple option is given then go for Best ..Here Queue is best B/C of FIFO property. 1 votes 1 votes AKASHSAINI commented Jul 6, 2017 reply Follow Share We use List for the efficient representation of the Graph as it takes Θ(V+E) memory and as BFS scans across the frontier of the graph we actually use Queue data structure for traversing... 0 votes 0 votes Please log in or register to add a comment.
4 votes 4 votes BFS uses queue data structure DFS uses stack data structure to implement efficiently pawan kumarln answered May 10, 2017 pawan kumarln comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes Queue is used to implement traveral in Breadth First Search. Stack is used to implement traversal in Depth First Search. POOJAN SHAH answered Aug 24, 2017 POOJAN SHAH comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes Option b queue Purvi Agrawal answered May 10, 2017 Purvi Agrawal comment Share Follow See all 0 reply Please log in or register to add a comment.