Question: C++ DATA STRUCTURES 8. The following struct is used to represent magnetic animals struct manimal f string name, species: int weight; manimal (string n, string

C++ DATA STRUCTURES

C++ DATA STRUCTURES 8. The following struct is used to represent magnetic

8. The following struct is used to represent magnetic animals struct manimal f string name, species: int weight; manimal (string n, string s, int w) { name=n ; species-s ; weight=w; } }; Magnetic animals are to be stored in a Binary Tree, ordered by their names A. Define the necessary struct(s) together with an add method, so that this sample code would correctly build a tree containing six animals ManiTree zoo zoo.add (new manimal ("Lenny", "lion", 320)) zoo.add (new manimal ("Sammy", "seal", 135)) zoo.add (new manimal ("Quacky, "puppy-eating duck", 5)) zoo.add (new manimal ("Timmy", "tiger", 251)) zoo.add (new manimal ("Rosie", "pony", 260)): zoo.add (new manimal ("Geoffrey", "georaffe", 1326)) Draw the tree, showing nodes connected by pointers, as it would be directly fter the sample code is execute Add a method to the tree-of-animals class. It should take an animal's name as its parameter, and return as its result that animal's weight, or -999 if there is no match. Your method should not print the result itself, just return it. So int w zoo.weightof ("Timmy") cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!