25.4k views
2 votes
Choose the best collection for each situation.

You need to keep a record of the ages of the last 50 customers visit a restaurant. As new customers come in you delete the age that has been in the list the longest.

You need to store the GPS coordinates of the hospitals in a state in order to find the nearest hospital for ambulance helicopters.

You write a loop to save anywhere from 10 to 100 values from a user. You will pass the collection to a function to find the average.

User Kenesha
by
6.1k points

1 Answer

4 votes

Answer:

Deque: You need to keep a record of the ages of the last 50 customers visit a restaurant. As new customers come in you delete the age that has been in the list the longest.

Tuple: You need to store the GPS coordinates of the hospitals in a state in order to find the nearest hospital for ambulance helicopters.

List: You write a loop to save anywhere from 10 to 100 values from a user. You will pass the collection to a function to find the average.

Explanation: Just got the results back no thanks to the guy above

User Keepitterron
by
6.2k points