I apologize in advance for asking this, since I'm sure this site is flooded by amateurs like me asking about P and NP. If there's a better platform to ask this on, please let me know, but this question has always bothered me.
Suppose you have a perfect binary tree of depth $d$. Each node contains a boolean. Of the $2^{d}$ leaves, exactly one is labelled true
(at random) and the rest are false
. The question is "Is the true
node in the left half of the tree"? Clearly, there is no efficient algorithm for finding the true
node (since it has been assigned at random) besides exploring all $O(2^d)$ leaves. A solution, however, can be verified in $O(d)$ time by simply providing the path from the root node to the true
leaf.
If valid, this would be an example problem that is in NP, but not P, showing that P!=NP (unless I'm mistaken). I believe where this example goes wrong is that in the formal definition of a decision problem, $n$ is the size of the input. Since our tree is an input, $n=2^d$ and the naive algorithm is actually $O(n)$, and thus in P. Is this the only issue, or is there something more fundamental that I'm completely missing?
If that's the only issue, then can we circumvent it by some clever mechanism for generating a similar problem from a smaller input?