Choose a shape for the job

A shopping app could keep products in a list, look up a product by its code, or track orders waiting to be processed. Those jobs need different ways to organise data. The choice affects how easily a program can find or change an item.

Common structures include arrays for ordered items, maps and sets for lookups and unique items, stacks and queues for items waiting their turn, and trees and graphs for connections. A team chooses according to what the program needs to do most often.