Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am unsure about this question. I\'m currently thinking: a) List b) set c) map

ID: 3837394 • Letter: I

Question

I am unsure about this question. I'm currently thinking: a) List b) set c) map d) queue but I need an explanation for why. Please help!

7. Consider the four core interfaces, Set, List, Queue, and Map For each of the following parts, specify which of the four core interfaces is best-suited, and explain how to use it to implement the problem. (No need for code, just a sentence will do.) (a) Whimsical Toys Inc (WTI) needs to record the names of all its employees. Every month, an employee will be chosen at random from these records to receive a free toy. (b) WTI has decided that each new product will be named after an employee but only first names will be used, and each name will be used only once. Prepare a collection of unique first names. (c) WTI decides that it only wants to use the most popular names for its toys. Count up the number of employees who have each first name. (d) WTI acquires season tickets for the local lacrosse team, to be shared by employees. Create a waiting list for this popular sport.

Explanation / Answer

a) List can be used and then a random element from list can be sued to give award

b) set can be used for unique names. To implement just store first name in sets and that will be product name as set doesn't allow duplicate

c) map can be used here mapping employee first name to its count

d) waiting list is classic usage of queue as in waiting list top of list needs to be served first and new people should go to end of list.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote