Showing posts with label DATA STRUCTURE. Show all posts
Showing posts with label DATA STRUCTURE. Show all posts

INTRODUCTION TO MEMORY ALLOCATION IN "C"

=>FILE HANDLING IN C:

1) STATIC MEMORY ALLOCATION

2) DYANAMIC MEMORY ALLOCATION

BRIF DISCUSS ABOUT POINTS:

> In SMA memory is assign to varible at the starting of the program while in DMA memory is allocated at
 the running time of program.

>In SMA memory is fixed in case of DMA memory can be changed.

>In SMA inefficient use of memory while in case of DMA efficient use of memory.

>In DMA memory can be expanded or contracted.So this provide flexibility tn programmer.

=>DYNAMIC MEMORY ALLOCATION FUNCTION:

1) MALLOC( )

2) CALLOC( )

3) FREE( )

4) REALLOC( )

BRIEF DISCUSSION ABOUT POINTS:

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)]

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: