Traverse tree without recursion and stack in C
问题 How to traverse each node of a tree efficiently without recursion in C (no C++)? Suppose I have the following node structure of that tree: struct Node { struct Node* next; /* sibling node linked list */ struct Node* parent; /* parent of current node */ struct Node* child; /* first child node */ } It's not homework. I prefer depth first. I prefer no additional data struct needed (such as stack). I prefer the most efficient way in term of speed (not space). You can change or add the member of