Which of the following data structures is useful for traversing a given graph by breadth-first search?

a. Queue
b. List
c. Stack
d. Linked list

a. Queue
BFS performs level-order traversal that can be fairly done using a queue. A queue uses FIFO ordering and the nodes that we enqueue first are explored first maintaining the order of traversal.

Computer Science & Information Technology

You might also like to view...

A JSlider cannot display which of the following:

a. Major tick marks. b. Minor tick marks labels. c. Minor tick marks. d. Snap-to ticks.

Computer Science & Information Technology

Although the system has been operational for a short time, users already have submitted several requests for enhancements and noncritical changes. Should New Century use a maintenance release methodology to handle the requests? Why or why not?

What will be an ideal response?

Computer Science & Information Technology