This document introduces different data structures. It defines data structures as logical models for organizing data that are important for algorithm development and program implementation. It classifies data structures into primitive and non-primitive types. Primitive types include basic data like integers, while non-primitive types are more complex structures like arrays, linked lists, stacks, and queues that organize groups of data. Key non-primitive data structures are then defined, including their purposes and common operations.
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 of ARRAY.
The number inside the square bracket denotes the number of items or elements
stored in ARRAY. It is called as the length or size of ARRAY.
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
A stack 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.
OPERATION ASSOCIATED 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
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”
Figure : Array Representation Of Queue
AAA BBB CCC …………DDD
1 32 4 5 N
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.
2. GRAPH : Data sometimes contains relationship between pair of elements
which is not hierarchical in nature is called a graph.
A
B C
D
D
D D
D