What is Data Structure?
Data structure is a way to store and organize data in the main memory so that the
data can be accessed and modified in an efficient way. Data structures are
classified into two categories: linear data structure and nonlinear data structure.
Linear Data Structure
In a linear data structure, the data items or elements are arranged in a linear
fashion meaning they are arranged in a sequential manner and each element is
connected to the element in front of it and to the element behind it. The example
of linear data structures are:
Array
Queue
Stack
Linked List
Nonlinear Data Structure
In a nonlinear data structure, the data items or elements are not added in a
sequential manner. Examples of nonlinear data structure are:
Trees
Graphs
Array
Array is a collection of data items that are of the same type. It is a linear data
structure, and its data items are stored sequentially in the memory. Arrays are
also static in nature since they are always fixed in size.
Multidimensional Array
A multidimensional array is also known as an array of arrays, meaning we can store
many arrays inside an array. 2D array or two-dimensional array and 3D array or
three dimensional array are considered as multidimensional arrays.
Linked List
Linked list is a linear data structure and it consists of a group of nodes where
each node contains a data field to store data and an address field to store the
address of the next node which is also known as a pointer. It forms a chain-like
structure. In a linked list, the first node is referred to as head and the last
node is referred to as a tail and points to null value. A linked list is also
dynamic in nature.
Doubly Linked List
Doubly linked list is a linked list containing an extra pointer on every node which
points to the previous node. The advantages of a doubly linked list over a singly
linked list are:
It can be traversed in both directions.
Deletion operation is faster in doubly linked list.
Applications of Linked List
Some of the common applications of the linked list are:
Used for implementation of stacks and queues.
Used for maintaining the directory names in an operating system.
Used in image viewer software to navigate through the image using the next and
previous button.
Used in music players.
Stack
Stack is a linear data structure that follows a particular order known as LIFO
(Last In First Out) where the last element that was inserted will be the first one
to be removed. Insertion and deletion operations are done only from the top of the
stack.
Data structure is a way to store and organize data in the main memory so that the
data can be accessed and modified in an efficient way. Data structures are
classified into two categories: linear data structure and nonlinear data structure.
Linear Data Structure
In a linear data structure, the data items or elements are arranged in a linear
fashion meaning they are arranged in a sequential manner and each element is
connected to the element in front of it and to the element behind it. The example
of linear data structures are:
Array
Queue
Stack
Linked List
Nonlinear Data Structure
In a nonlinear data structure, the data items or elements are not added in a
sequential manner. Examples of nonlinear data structure are:
Trees
Graphs
Array
Array is a collection of data items that are of the same type. It is a linear data
structure, and its data items are stored sequentially in the memory. Arrays are
also static in nature since they are always fixed in size.
Multidimensional Array
A multidimensional array is also known as an array of arrays, meaning we can store
many arrays inside an array. 2D array or two-dimensional array and 3D array or
three dimensional array are considered as multidimensional arrays.
Linked List
Linked list is a linear data structure and it consists of a group of nodes where
each node contains a data field to store data and an address field to store the
address of the next node which is also known as a pointer. It forms a chain-like
structure. In a linked list, the first node is referred to as head and the last
node is referred to as a tail and points to null value. A linked list is also
dynamic in nature.
Doubly Linked List
Doubly linked list is a linked list containing an extra pointer on every node which
points to the previous node. The advantages of a doubly linked list over a singly
linked list are:
It can be traversed in both directions.
Deletion operation is faster in doubly linked list.
Applications of Linked List
Some of the common applications of the linked list are:
Used for implementation of stacks and queues.
Used for maintaining the directory names in an operating system.
Used in image viewer software to navigate through the image using the next and
previous button.
Used in music players.
Stack
Stack is a linear data structure that follows a particular order known as LIFO
(Last In First Out) where the last element that was inserted will be the first one
to be removed. Insertion and deletion operations are done only from the top of the
stack.