Imagine I have a binary heap, traversed in a breadth first manner like so:
0 1 | 2 3 | 4 | 5 | 6 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14
To the left of root (0) is 1, to the right is 2, to the left of 1 is 3 to it's right is 4 etc.
So node 13 corresponds to the following pattern (right right, left, (or 0,0,1, perhaps)).
The question is, is there an equation, function, or algorithm that will produce the pattern to get to any node without actually producing the entire tree and traversing it?
Say I didn't create the tree in memory (it's just a virtual tree). How would I know that in order to get to 8 I need to start at root and go: left,left, right (1,1,0)?
Is this computable without creating the tree, and traversing it? If so what is the pattern for 42? is it easily calculable (is it linear) ?
I'm sorry for not knowing all the CS terms (I'm not a cs major, but I want to know if there's a deterministic algorithm to produce a path to any node, if so, whats it's computational efficiency) ?