4.46 One can check if two trees are isomorphic by doing a post-order traversal of both trees, and labeling each
node with an integer during the traversal.
The algorithm will use a two dimensional array L[i,j], initially with no values assigned; and an integer k,
initially set 1.
4.47 The easiest solution is to compute, in linear time, the inorder numbers of the nodes in both trees. If
right
subtrees). If dN is the depth of x, then the running time satisfies T (N) = T (i) + T (N − i − 1) + dN,
where i is the size of the left subtree. In the worst case, dN is always O(N), and i is always 0, so the
4.49 (a) You need an extra bit for each thread.
4.50 The code below ignores sidebar comments but not /* */ comments. The list of reserved words can be
changed according to the interpretation of the problem.
#include <fstream>
#include <cctype>