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:

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)
Transcribed Image Text:6 6 (3) (8) 8 279 972 (3)
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer