You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Some Iterative methods for binary tree traversal have visited nodes stored in a stack, which is bad for a number of reasons.
The text was updated successfully, but these errors were encountered: