isMirror
that takes two nodes, left
and right
, as arguments.left
and right
are null, return true
(base case for symmetry).left
or right
is null, return false
(base case for asymmetry).left
and right
are not equal, return false
.isMirror
on the left child of left
and the right child of right
, and on the right child of left
and the left child of right
.true
if both recursive calls return true
, otherwise return false
.isSymmetric
calls isMirror
with the left and right children of the root node.