Some Iterative methods for binary tree traversal have visited nodes stored in a stack, which is bad for a number of reasons.
- Getting an element from a stack takes O(n) time and should be replaced by a dynamic array where getting an element from an array takes O(1) time. Generally prefer Dynamic Arrays over Linked Lists
- Another good replacement for a stack is to use flags where each object has a flag telling whether the object has been visited once already.