Past exam question: 2076 Baisakh (Back), Q1
Open in the Padhaiko appQuestion
Define data structure with its types.
Solution
Definition of Data Structure: A data structure is an organized format for storing, accessing, and managing data in computer memory so that operations (insertion, deletion, search, traversal) execute efficiently.
Classification of Data Structures:
- Primitive Data Structures: Basic built-in atomic types directly operated on by machine instructions (
int,float,char,double, pointers). - Non-Primitive Data Structures: Derived collections built from primitive types, divided into:
- Linear: Elements arranged sequentially (Arrays, Stacks, Queues, Linked Lists).
- Non-Linear: Hierarchical or network structures (Trees, Binary Search Trees, AVL Trees, Graphs).
- (Also classified as Static with fixed compile-time size like arrays vs. Dynamic with runtime heap growth like linked lists.)
Answer:
A data structure organizes data in memory for efficient manipulation. Its primary types are primitive (int, float, char) and non-primitive, where non-primitive structures split into linear (arrays, stacks, queues, linked lists) and non-linear (trees, graphs).