2. Definition
TO DESIGN AND IMPLEMENTATION OF ALGORITHMS AND FOR
DEVELOPMENT OF PROGRAM, ORGANIZATION OF DATA IS
IMPORTANT
LOGICAL OR MATHEMATICAL MODEL OF A PARTICULAR
ORGANIZATION OF DATA IS CALLED DATA STRUCTURE.
ALGORITHMS + DATA STRUCTURE=PROGRAMS
3. Data Structure Are Classified Into
Two Types
1. Primitive Data Structure
2. Non-primitive Data Structure
7. Primitive data structures are those which are predefined
way of storing data by the system.
The set of operations that can be performed on these
data are also predefined.
Primitive data structures are character, integer, float,
pointer.
Primitive Data Type
8. Non Primitive Data Type
The data types that are derived from primary data types are
known as non-primitive data types.
These data types are used to store group of values.
The non- primitive data types are
Arrays
Structure
Linked list
Stacks
Queue
9. Array
ARRAY is a set of finite collection of homogeneous or same types of data items.
Which means that we can store only one type of data in the array.
We can declare array as : int ARR[14]
Int specifies the type of data we want to store in array.
ARR is the name ofARRAY.
The number inside the square bracket denotes the number of items or elements
stored inARRAY. It is called as the length or size ofARRAY.
10. Linked List
A link list or one way list is a linear collection of data elements,
called nodes, where the linear order is given by means of pointer.
It is divided into two parts: First part contains the information of
element and second part contains the address of the next node.
START
Information
Part
Next pointer field
11. Stack
Astack is a linear structure in which items are added or removed only at one end.
It is also known as “LAST IN FIRST OUT” [LIFO] lists.
Stack is also known as “PILES” and “ PUSH DOWN ” lists.
OPERA
TIONASSOCIA
TED WITH STACK
1. PUSH: It is used to insert an element into stack.
2. POP: It is used to remove or delete an element from a stack.
13. Queue
Figure :Array Representation Of Queue
AAA BBB CCC DDD …………
1 2 3 4 5 N
A queue is also called as FIRST IN FIRST OUT [FIFO] system.
It is a linear list in which deletion can take place only at one end of the list i.e.
“FRONT” of the list
In queue Insertion can take place only at other end of the list. i.e. “REAR”
Front=1
Rear = 4
14. Non-Linear Data Structure
1. TREE : It is a non linear is mainly used to represent data
containing a hierarchical relationship between elements.
A
B C
D
2. GRAPH : Data sometimes contains relationship between pair of elements
which is not hierarchical in nature is called a graph.
D
D D
D