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?)
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
Email me when people comment.
Email me when people comment.
Loading...
An error occurred in subscribing you.
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Open Chat in New Window
Open Chat in New Window