Bartleby Related Questions Icon

Related questions

Question

Write a recursive method(Code )

static void mirrorTree(node root)

This will take a tree as input and then change the tree such that it becomes a mirror of itself.

We have the following methods implemented(you can use them and assume we coded somewhere else): getLeft(), getRight(), setLeft(), setRight(), getValue(). All the values in a node are integers. [Hint: Use them, and think how you would write when the tree only has 2 children ]

Example:

6
6
(3) (8)
8
279 972
(3)
expand button
Transcribed Image Text:6 6 (3) (8) 8 279 972 (3)
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions