I was wondering if there was a way to iteratively check if two binary trees were isomorphic to each other (in fact, we all know the problems with recursion), so far this is the best solution I've found: https://github.com/deepwritescode/isomorph#iterative.
However, I would like to remove the check condition on the value of the nodes; because what I need should be limited to checking the structure of the trees, instead of their actual values inside the nodes... Every language is accepted.
P.S.: this implementation doesn't work either: https://www.geeksforgeeks.org/iterative-approach-to-check-if-two-binary-trees-are-isomorphic-or-not/
To check if two trees (with value-less nodes) are isomorphic, you need to take into account that several nodes in the second tree may have their child trees reversed when compared to the first tree.
With a recursive algorithm you would need at least two recursive calls to be made at the same node, or more. The state in which these calls are made are different, and that state needs to be taken into account when rewriting it in an iterative way (and stack based).
Here is solution code in Python: