Showing posts with label TYPES. Show all posts
Showing posts with label TYPES. Show all posts

INTRODUCTION TO QUEUE

DEFINATION:

QUEUE:- is a collection of node. Queue consist of two parts

a) FRONT- items are deleted from the front part of queue.
b) REAR- items are inserted from the rear part of queue.

*Order of insertion is same to that of order of deletion of data items of queue.

*it is based on FIFO( FIRST IN FIRST OUT )

*Eg-suppose we want to add items in queue say a b c d e etc. so order of insertion a b c d e. Order of deletion a b c d e etc.

*queue deals with manipulation and retrival of data items from the internal memory.

*QUEUE is a LINEAR DATA STRUCTURE.

REPRESENTATION OF QUEUE:
 2 METHODS

1) ARRAY REPRESENTATION OF QUEUE

2)DYNAMIC IMPLEMENTATION OF QUEUE

HOW TO INSERT AND DELETE IN QUEUE:

ARRAY IN DATA STRUCTURE

TYPES OF ARRAY:
3 TYPES
1) ONE DIMENSIONAL ARRAY
2) MULTIDIMENSIONAL ARRAY
a) 2 DIMENSIONAL ARRAY
b) 3 DIMENSIONAL ARRAY
=>ADDRESS CALCULATION IN 1-D ARRAY:
LOC(A[K])=BASE A + W[K-LB]
where w=number of bytes per memory cell.
LB stands for lower bound.
=> ADDRESS CALCULATION IN 2-D ARRAY:
(a) ROW MAJOR ORDER
LOC[(J,K)]=BASE A +W[N(J-LB)+(K-LB)]

ARRAY IN C

BREIF ABOUT ARRAY

ARRAY: is a collection of similar data type elements.
 Eg: 1) int b[10] means all the elements in array have similar data type i.e int
 2) float a[5] all the elements in array have same data type i.e float

DATA TYPE: means what type of value you can store in a variable.

VARIABLE: is named memory area that can hold the items.

DIFFERENT TYPES OF DATA TYPES:

1) INT means in this data type integer values are stored in variables.
Eg: int a[ 10,20,30,40,50]

2)FLOAT means in this data type only decimal values are allowed to store in variable.
Eg: float b[1.2, 1.5, 8.9,5.0, 4.0]

*In this example there is important point that in float data type we assign integer value to variable b. But in case of int data type we can not assign decimal values to variable.

3) CHAR: is a character type data type.
Eg: char G[a,b,c,d,e ]

4) STRING: is a data type that is collection of characters.
Eg: string A[shubham, visitors, pageviews]

* ALL THE ABOVE FOUR DATA TYPES ARE PRIMITIVE DATA TYPES.

*NON-PRIMITVE DATA TYPES:

INTRODUCTION TO GRAPH

Defination of Graph:

It consist of different points called nodes or vertex which are connected to each other lines called edges.

¤ graph is a set of nodes and vertexes.

¤ graph is denoted by G={ V, E}
where V denotes set of vertexes and E denotes set of edges.

¤ graph is non linear data structure where linked list , array , stack and queue are linear data structure.


¤ graph is widely used for different purposes i.e it has lot of applications.

¤ graph is used when there is a relation ship between pair of data items or elements.

¤Types:
2 types of graph=>

1) directed graph
2) undirected graph

explanation:

¤ directed graph: graph in which each edge assign a direction.
eg=>

¤ undirected graph: graph in which there is no direction assign to each edge.
eg=>

¤Basic definations related to graph.

A) degree of vertex: number of edges incident on that vertex.

Types of degree: