Skip to main content

Data structure and basic operations

Short answer

A data structure organizes and stores data for efficient operations. Basic operations include traversal (visiting every element), search, insertion, deletion, sorting, merging, and updating.

Define a data structure. Explain the basic data structure operations.

A data structure is a particular way of organising and storing data in the memory of a computer so that it can be accessed, searched and modified efficiently. It also includes the set of operations defined on the organised data. Examples: array, stack, queue, linked list, tree, graph.

Basic data structure operations

OperationMeaning
TraversingVisit every element exactly once to process it (e.g., print all items)
SearchingFind the location of an element with a given value or key
InsertionAdd a new element to the structure
DeletionRemove an existing element
SortingArrange elements in ascending or descending order
MergingCombine two sorted structures into one sorted structure
UpdatingChange the value of an existing element

Example for an array A = {10, 20, 30}: traversing prints 10, 20, 30; searching for 20 returns index 1; inserting 15 at index 1 gives {10, 15, 20, 30}; deleting 30 gives {10, 15, 20}. Stack and queue add their own operations (push/pop, enqueue/dequeue).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 1 questions →