227k views
2 votes
A group of children want to play a game, called UnMonopoly, where the player with the most money must give half of his/her money to the player with the least amount of money. What data structure(s) must be used to play this game efficiently, and Why?

User Synchro
by
4.2k points

1 Answer

6 votes

Answer:

Using max heap

Step-by-step explanation:

Information of each player - Structure. Here one field should be the total value of the properties for taking comparison between the players. Information of each players - An array of the structures (property). Information of each property - structure. Information about all property - array of the structures. Chance and also community chest cards - the queue in data structures.

We can use max heap and then the root will be children having the highest amount of money.

User Hawkee
by
3.6k points