Ask your own question, for FREE!
Computer Science 10 Online
OpenStudy (s3a):

Write a recursive algorithm that tests if the trees rooted at two given tree nodes are isomorphic. Given that the question requests a signature: isIsomorphic(treeNode A, treeNode B) with input of treeNode A and treeNode B and boolean output of true or false depending on whether A and B are isomorphic or not, I am confused as to how I can use recursion since I don't see how the indices of whatever can be tracked with such an input. If more information is needed, just ask and any help would be greatly appreciated! Thanks in advance!

OpenStudy (rsmith6559):

I would write a recursive function that reads one tree. Then add the code to do a second tree at the same time (mostly mirroring any mention of the first tree's variable name). At every point, both traversals need to have the same result: if( A->left != NULL) && ( B->left != NULL ) { // traverse the left nodes } else return false;

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
3 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
3 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!