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. QueueBreadth-first search (BFS) is implemented using a Queue. BFS visits the nodes in a graph level by level.

  1. A.

    Queue

  2. B.

    Stack

  3. C.

    LinkedList

  4. D.

    None of the above

Attempted by 879 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.

Explore the full course: Cocubes Preparation

Loading lesson…