What is a data structure?
A data structure is a way of organizing and storing data in a computer's memory so that it can be conveniently and efficiently accessed, modified, and processed.
Different data structures solve different problems:
- an array is convenient for fast access by index;
- a list is for frequent insertions and deletions;
- a dictionary (hash table) is for fast lookup by key;
- a tree is for hierarchies and fast searches;
- a queue and a stack are for ordered processing of elements.
In other words, a data structure determines exactly how data is stored and what can be done with it quickly.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.