Past exam question: 2072 Ashwin (Regular), Q1
Open in the Padhaiko appQuestion
Define a data structure? Explain the basic data structure operations.
Solution
Definition of Data Structure: A data structure is a systematic way of organizing, storing, and relating data items in computer memory so they can be accessed and processed efficiently.
Basic Operations on Data Structures:
- Traversing: Visiting every element of the structure exactly once to inspect or process it.
- Searching: Locating the position of a specific element matching a given key.
- Inserting: Adding a new data element into the structure (at head, tail, or a specified position).
- Deleting: Removing an existing data element and restoring structural invariants.
- Sorting: Arranging elements into ascending or descending order.
- Merging: Combining two sorted structures into a single sorted structure.
Answer:
A data structure organizes data in memory for efficient use; its six core operations are traversing, searching, inserting, deleting, sorting, and merging.