DATA STRUCTURE - A data structure is a particular way of
organizing data in a computer so that it can be used effectively. The idea is
to reduce the space and time complexities of different tasks. Below is an
overview of some popular linear data structures.
Basic
types of Data Structures
As we
have discussed above, anything that can store data can be called as a data
structure, hence Integer, Float, Boolean, Char etc, all are data structures.
They are known as Primitive Data Structures.
Then we
also have some complex Data Structures, which are used to store large and
connected data. Some example of Abstract Data Structure is:
- Linked List
- Tree
- Graph
- Stack, Queue etc.
All these data structures
allow us to perform different operations on data. We select these data
structures based on which type of operation is required. We will look into
these data structures in more details in our later lessons.
The data
structures can also be classified on the basis of the following
characteristics:
Characteristic
|
Description
|
Linear
|
In Linear data structures, the data
items are arranged in a linear sequence. Example: Array
|
Non-Linear
|
In Non-Linear data structures, the
data items are not in sequence. Example: Tree, Graph
|
Homogeneous
|
In homogeneous data structures, all
the elements are of same type. Example: Array
|
Non-Homogeneous
|
In Non-Homogeneous data structure,
the elements may or may not be of the same type. Example: Structures
|
Static
|
Static data structures are those
whose sizes and structures associated memory locations are fixed, at compile
time. Example: Array
|
Dynamic
|
Dynamic structures are those which
expand or shrink depending upon the program need and its execution. Also,
their associated memory locations changes. Example: Linked List
created using pointers
|
Categories of Data Structure
The data structure can be
sub divided into major types:
§
Linear Data Structure
§
Non-linear Data Structure
Linear Data Structure
A data structure is said
to be linear if its elements combine to form any specific order. There are
basically two techniques of representing such linear structure within memory.
§
First way is to provide the linear relationships among all the
elements represented by means of linear memory location. These linear
structures are termed as arrays.
§
The second technique is to provide the linear relationship among
all the elements represented by using the concept of pointers or links. These
linear structures are termed as linked lists.
The common examples of
linear data structure are:
·
Arrays
·
Queues
·
Stacks
·
Linked lists
Non linear Data Structure
This structure is mostly
used for representing data that contains a hierarchical relationship among
various elements.
Examples of Non Linear
Data Structures are listed below:
1.
Graphs
2.
family of trees and
3.
table of contents
Tree: In this case, data
often contain a hierarchical relationship among various elements. The data
structure that reflects this relationship is termed as rooted tree graph or a
tree.
Graph: In this case, data sometimes hold a
relationship between the pairs of elements which is not necessarily following
the hierarchical structure. Such data structure is termed as a Graph.