📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    In a Breadth-First Search (BFS) algorithm for graph

    traversal, what is the primary role of a queue?
    A To keep track of visited nodes Correct Answer Incorrect Answer
    B To store the path from source to destination Correct Answer Incorrect Answer
    C To manage nodes to be visited in a level-by-level order Correct Answer Incorrect Answer
    D To prioritize nodes based on their value Correct Answer Incorrect Answer
    E To reverse the order of node processing Correct Answer Incorrect Answer

    Solution

    BFS uses a queue to explore nodes level by level. Nodes are enqueued when discovered and dequeued to visit their neighbors, ensuring that all nodes at the current depth are visited before moving to the next depth.

    Practice Next
    ask-question