Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions