Get the next leaf space of complete binary tree

Does anyone want to help me with this, if only pseudocode or general steps? Going to be doing it in python fwiw.

What I really need is the parent node of the next open leaf space, the next proud parent iow. I can use a queue traversal otherwise, but I have to return the parent, so I have something that can actually point to the new leaf.

Comments (1)