Data Structures
Data Structures
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
Queue are first in first out type of data structure (i.e. FIFO)
In a queue new elements are added to the queue from one
end called REAR end and the element are always removed
from other end called the FRONT end.
The people standing in a railway reservation row are an
example of queue.
QUEUE
Each new person comes and stands at the end of the row
and person getting their reservation confirmed get out of
the row from the front end.
The bellow show figure how the operations take place on
a stack:
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