Tag Archives: Breadth-First Search

Draw a graph and illustrate how depth-first search and breadth-first search differ

This was the first ques­tion in Com­puter Offi­cer Exam­i­na­tion in 2010 con­ducted by Pub­lic Ser­vice Com­mis­sion (Lok Sewa Aayog). This ques­tion is from the sec­tion ‘Data Struc­tures and Algo­rithms’. The ques­tion car­ries 10 marks.

Answer

bfs-dfs-graph

Breadth-first search (BFS) and depth-first search (DFS) are the two algo­rithms used for tra­vers­ing and search­ing a node in a graph. They can also be used to find out whether a node is reach­able from given node or not.

Posted in Algorithms and Data Structures, Computer Officer, Question Papers, Questions and Answers | Tagged BFS, Breadth-First Search, computer officer exam, Data Structures and Algorithms, Depth-First Search, DFS, Graphs, Lok Sewa Aayog, Public Service Commission, Solved Question of Computer Officer | 2 Comments