Question: Write a new class, PokemonMain, with a main method that: a . Creates a binary tree with your favorite Pok mon at the root and
Write a new class, PokemonMain, with a main method that:
a Creates a binary tree with your favorite Pokmon at the root and a new PokemonComparator.
b Insert at least more Pokmon in any order.
c Use your StringVisitor to stringify the binary tree and print the string. They should print in reverse order by number from largest to smallest
The Comparable interface is implemented by a class that needs to define its own natural order. It is called on one instance of the class to compare itself to another instance of the same class, eg A compareToB It works the same way that Comparable does:
a It returns an integer if A comes before in order, ie ABA
returns A and are equivalent,
returns integer A comes after order,
Update your Pok class implement Comparable that the Pok are arranged order number smallest largest For example, Pokemon number and number compareTo would return a number because A should come first.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
