Which data structure is used to implement breadth-first search (BFS) of a graph?
2024
Which data structure is used to implement breadth-first search (BFS) of a graph?
Answer: A. Queue — Breadth-first search (BFS) is implemented using a Queue. BFS visits the nodes in a graph level by level.
- A.
Queue
- B.
Stack
- C.
LinkedList
- D.
None of the above
Attempted by 863 students.
Show answer & explanation
Correct answer: A
Breadth-first search (BFS) is implemented using a Queue. BFS visits the nodes in a graph level by level.
Loading lesson…