Data Structures
Data Structures
Primitive DS Non-Primitive DS
For(i=0;i<=9;i++)
printf(“%d”,arr[i]);
Arrays
If we are reading or writing two-
dimensional array it would require two
loops. And similarly the array of a N
dimension would required N loops.
Some common operation performed on
array are:
Creation of an array
Traversing an array
Arrays
Insertion of new element
Deletion of required element
Modification of an element
Merging of arrays
Lists
A lists (Linear linked list) can be defined as a
collection of variable number of data items.
Lists are the most commonly used non-
primitive data structures.
An element of list must contain at least two
fields, one for storing data or information and
other for storing address of next element.
As you know for storing address we have a
special data structure of list the address must
be pointer type.
Lists
Technically each such element is referred to
as a node, therefore a list can be defined as
a collection of nodes as show bellow:
[Linear Liked List]
Head
[STACK]
Stack
The stack can be implemented into two
ways:
Using arrays (Static implementation)
front rear
Queue
The queue can be implemented into two
ways:
Using arrays (Static implementation)
A root
B C
D E F G
Graph
Graph is a mathematical non-linear data
structure capable of representing many kind
of physical structures.
It has found application in Geography,
Chemistry and Engineering sciences.
Definition: A graph G(V,E) is a set of
vertices V and a set of edges E.
Graph
An edge connects a pair of vertices and
many have weight such as length, cost and
another measuring instrument for according
the graph.
Vertices on the graph are shown as point or
circles and edges are drawn as arcs or line
segment.
Graph
Example of graph:
6
v2 v5
v1 v3
10
v1 8 11
15
9 v2
v3 v4 v4
Undirected graph
Simple graph
Weighted graph
Connected graph
Non-connected graph