introdution to datastructures
introdution to datastructures
DEFINITION
Data structure
Primitive DS Non-Primitive DS
Non-Primitive DS
PUSH POP
[STACK]
STACK
The stack can be implemented into
two ways:
Using arrays (Static
implementation)
Using pointer (Dynamic
implementation)
QUEUE
10 20 30 40 50
front rear
QUEUE
The queue can be implemented into
two ways:
Using arrays (Static
implementation)
Using pointer (Dynamic
implementation)
TREES
A tree can be defined as finite set of data
items (nodes).
Tree is non-linear type of data structure in
which data items are arranged or stored in
a sorted sequence.
Tree represent the hierarchical relationship
between various elements.
TREES
In trees:
There is a special data item at the top of
hierarchy called the Root of the tree.
The remaining data items are partitioned into
number of mutually exclusive subset, each of
which is itself, a tree which is called the sub
tree.
The tree always grows in length towards
bottom in data structures, unlike natural trees
which grows upwards.
TREES
The tree structure organizes the data into branches,
which related the information.
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 according to 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