The correct answer is: B. Queues
A queue is a linear data structure in which elements are added at the end (enqueue) and removed from the beginning (dequeue). This makes it a convenient data structure to use for Breadth First Search (BFS), as the next node to be visited is always the one at the front of the queue.
A stack is a linear data structure in which elements are added and removed from the same end (the top). This makes it a convenient data structure for Depth First Search (DFS), as the next node to be visited is always the one at the top of the stack.
A priority queue is a data structure that stores elements with a priority associated with each element. The elements are then sorted in order of their priority, with the highest priority elements being at the front of the queue. This makes it a convenient data structure for tasks that require elements to be processed in order of their priority, such as scheduling tasks or finding the shortest path between two nodes in a graph.
However, a priority queue is not a convenient data structure to use for BFS, as the next node to be visited is not always the one with the highest
81.2-142.7 81.2z"/> Subscribe on YouTube