/* Copyright (c) 1982 Regents of the University of California */
static char sccsid
[] = "@(#)tr_equal.c 1.1 1/18/82";
* A recursive tree search routine to test if two trees
* are structurally equivalent.
if (t1
== NIL
&& t2
== NIL
) {
if (t1
== NIL
|| t2
== NIL
) {
if (t1
->op
!= t2
->op
|| degree(t1
->op
) != degree(t2
->op
)) {
return(t1
->nameval
== t2
->nameval
);
if (!tr_equal(t1
->right
, t2
->right
)) {
return(tr_equal(t1
->left
, t2
->left
));
return(t1
->lconval
== t2
->lconval
);
return(t1
->fconval
== t2
->fconval
);
return(t1
->sconval
== t2
->sconval
);
panic("tr_equal: leaf %d\n", t1
->op
);
if (!tr_equal(t1
->right
, t2
->right
)) {
return(tr_equal(t1
->left
, t2
->left
));
panic("tr_equal: bad degree for op %d\n", t1
->op
);