Can someone please explain why the time complexity is written as is in this problem in Cracking the Coding Interview 6th edition?
On page 378, it explains a solution to a system design problem.
It says that the big O analysis of BFS is O(q^k).
Shouldn't it be O(k^q) instead? (Assuming that each person has k nodes and q is the length of the path. We'd have to go through k nodes per level and there are q levels, right?)
Open Chat in New Window