1.1 Introduction to Data Structures Linear and Non Linear Data (1)
1.1 Introduction to Data Structures Linear and Non Linear Data (1)
A data structure is a particular way of organising data in a computer so that it can be used
effectively. The idea is to reduce the space and time complexities of different tasks.
Based on memory allocation, the Linear Data Structures are further classified into two types:
1. Static Data Structures: The data structures having a fixed size are known as Static Data
Structures. The memory for these data structures is allocated at the compiler time, and their size
cannot be changed by the user after being compiled; however, the data stored in them can be
altered.
The Array is the best example of the Static Data Structure as they have a fixed size, and its
data can be modified later.
2. Dynamic Data Structures: The data structures having a dynamic size are known as Dynamic
Data Structures. The memory of these data structures is allocated at the run time, and their size
varies during the run time of the code. Moreover, the user can change the size as well as the
data elements stored in these data structures at the run time of the code. Linked
Lists, Stacks, and Queues are common examples of dynamic data structures.
(iv) Linked List: Linked list is a collection of data of same type but the data items need not be
stored in consecutive memory locations. It is linear but non-contiguous type data structure. A
linked list may be a single list or double list.
• Single Linked list: - A single list is used to traverse among the nodes in one direction.
• Double linked list: - A double linked list is used to traverse among the nodes in both the
directions.