178k views
2 votes
What are the best data structures to create the following items? And why?

1. Designing a Card Game with 52 cards.
2. Online shopping cart (Amazon, eBay, Walmart, Cosco, Safeway, ...)
3. Online waiting list (De Anza College class waiting list, ...)
4. Online Tickets (Flight tickets, concert tickets, ...)

User Yanhua
by
8.3k points

1 Answer

2 votes

Answer:

The best structures to create the following items are

  1. ARRAY
  2. HASHMAPS
  3. QUEUE
  4. SORTED LINK LISTS

Step-by-step explanation:

The best structures to create the following items are:

  1. Array : for the storage of cards in a card game the best data structure to be used should be the Array data structure. this is because the size of the data ( 52 cards ) is known and using Array will help with the storing of the cards values in the Game.
  2. Hashmaps : Hashmap data structure should be implemented in online shopping cart this IS BECAUSE items can be easily added or removed from the cart therefore there is a need to map the Items ID or name to its actual database
  3. online waiting list are usually organised/arranged in a first-in-first-out order and this organization is best created using the queue data structure
  4. Sorted link lists is the best data structure used to create, store and manage online tickets. the sorted link data structure helps to manage insertions and deletions of tickets in large numbers and it also reduces the stress involved in searching through a large number of tickets by keeping the tickets in sorted lists
User SomeDude
by
8.0k points