Here is an example of a question that asks for a big-O analysis of a function (to count the number of ways to make change): What is the run time of this algorithm?
Here is my algorithm
I want to know what the run time of this algorithm is. I initially thought it would be \$O(4^n)\$ since each call makes up to 4 recursive calls.
But, for an amt of 10, that would be 1,048,576 and that seems insane. How do I go about finding out what the big \$O\$ of this is? (I'd appreciate the method to approach the answer rather than the answer directly)
We have many questions where complexity is a concern, and we even have a complexity tag for it. Also, we have time-limit-exceeded questions, for which answers often give a diagnosis that the algorithm scales poorly.
But this question seems to be purely about how to determine the complexity of some given code, with no interest in improving the code. Seeking an explanation of how code works is explicitly off-topic.
- Is this question off-topic for Code Review, by the current rules? If so, do you believe that the prohibition is justified?
- There are many complexity questions that are currently considered on-topic. Where do we draw the line?
- Could this lead to a migration hot potato with Stack Overflow, where Code Review rules it off-topic because it's not seeking a critique, but Stack Overflow wants to send it to Code Review because it's primarily a discussion of the author's code? What guidance should we give to the author to help resolve jurisdictional issues?