Implement radix sort to improve the time cost of tree isomorphism. Possible reference: Aho, Hopcroft, Ullman, 1974: The Design and Analysis of Computer Algorithms. Remember to test it and profile it.