Which trees/graphs search method takes less memory?

2024

Which trees/graphs search method takes less memory?

  1. A.

    Depth-First Search

  2. B.

    Breadth-First search

  3. C.

    Linear Search

  4. D.

    More than one of the above

  5. E.

    None of the above

Attempted by 577 students.

Show answer & explanation

Correct answer: A

Correct Answer: Depth-First Search

Depth-First Search (DFS) uses a stack to store nodes. Memory usage is proportional to the maximum depth of the tree. Breadth-First Search (BFS) uses a queue and stores all nodes at the current level, requiring more memory.

सही उत्तर: डेप्थ-फर्स्ट सर्च

डेप्थ-फर्स्ट सर्च (DFS) नोड्स स्टोर करने के लिए स्टैक का उपयोग करता है। मेमोरी उपयोग वृक्ष के अधिकतम गहराई के समानुपाती होता है। ब्रेड्थ-फर्स्ट सर्च (BFS) क्यू का उपयोग करता है और वर्तमान स्तर के सभी नोड्स स्टोर करता है, जिसमें अधिक मेमोरी लगती है।

Explore the full course: Up Lt Grade Assistant Teacher 2025