I am using AHU algorithm to detect if two rooted trees are isomorphic or not, and I used this algorithm, I have sent it to my teacher and my teacher put a comment that there is a mistake in this algorithm according to your example of trees, but I can not see where is my mistake?
you see the small yellow box it the image? that's the comment
and this is the example according to the image, in this part, I am supposed to assign tuples in the form of parentheses to the leaves of trees and from button to up to the root it gets children's parentheses
now I have to convert these parentheses to numbers, so I could obtain the canonical numbers of a tree... and then sort the number so for each tree I could have a unique number and compare these two numbers between then tree to check if they are similar or not
Here I have sorted the algorithm
and here is the algorithm for converting the parentheses to numbers, but the thing I do not see is from my perspective this algorithm matches with the examples I have provided, but as you see in the first image, the little yellow box is the comment I have gotten from teacher that "there is a mistake here", and I don't know what is it
What do you think is my mistake?