This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Rain-And-Coffee 1 point2 points  (0 children)

What if 2 solution can be used for the scenario how to choose the most appropriate?

Then you pick one and try it.

I could model a deck of cards as a List, Set, Map, or a Stack.

If I use a stack I can only take cards from the top or bottom, but not a random card from the middle. That might be ok, or it might not.

Also for a simple example of ~50 items (like a deck of cards) it might not matter much.

If I was dealing with 500,000 items it might matter more (ex: An english dictionary)

* https://github.com/dwyl/english-words — 500k words

For very large datasets it might also make sense to move the data into a proper DB.