📞 0339-0387701 (WhatsApp) Contact

« Back to Data Science & AI (NCCIA)

What is the space complexity of depth-first search with maximum depth m and branching factor b?

A. O(b x m) ✅
B. O(b^m)
C. O(b^d)
D. O(m^2)

Correct Answer: A. O(b x m)

Explanation

Depth-first search stores only the current path and its siblings, so memory grows linearly with depth.