Question: Question 2. (12 points) You can now code addBuildings. The argument is a Building. Given a Building b and a Building bToAdd, the command b.addBuildings(bToAdd)

Question 2. (12 points) You can now code addBuildings. The argument is a Building. Given a Building b and a Building bToAdd, the command b.addBuildings(bToAdd) rst adds the OneBuilding bToAdd.data to b, then goes on by adding the Building bToAdd.older, then bToAdd.Same and nally bToAdd.younger and returns the root of the tree structure as in the case for addBuilding. For instance, if we have the two following Buildings : b3(1987; 55) b3:older w b3:same b3:younger ' b4(1985; 50) b4:same b1(1987; 50) b2(1988; 60) b5(1985; 45) b6(1985; 60) b6:younger ' b7(1986; 55) b7:younger ' b8(1995; 55) 5 The command b1.addBuildings(b6) will return b1 and update the tree structure to : b3(1987; 55) b3:older s b3:same b3:younger ( b6(1985; 60) b6:same b6:younger ( b1(1987; 50) b2(1988; 60) b2:younger ( b4(1985; 50) b4:same b7(1986; 55) b8(1995; 55) b5(1985; 45)

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!