c++,memory-management,tree,game-engine,data-oriented-design
Short version: Use 6502's pre-order answer instead. I'll leave my previous answer below because it still has some interesting code and comments. Lay out your storage array in a semi-pre-order fashion. That is: sentinel end node, roots, first root's children, first root's first child's children, first root's first grandchild's children,...