Posts

Showing posts from July, 2024

DAA lab practical program (B.tech 6th sem)

DAA lab practical program PDF download     DAA lab practical program b.tech 6th sem   1. Sort a given set of elements using the Quicksort method and determine the time  required to sort the elements. Repeat the experiment for different values of n, the  number of elements in the list to be sorted and plot a graph of the time taken versus n. The elements can be read from a file or can be generated using the random number  generator. Solution:-  #include<stdio.h> #include<sys/time.h> void swap(int *x,int *y) { int temp; temp=*x; *x=*y; *y=temp; } void generate_random(int a[],int n) { int i; srand(time(0)); for(i=0;i<n;i++) a[i]=rand()%1000; } int Partition(int a[10],int l,int h) { int i,j,p; i=l;j=h+1; p=l; do{ do{  i=i+1; }while(a[i]<a[p]); do{ j=j-1; }while(a[j]>a[p]); swap(&a[i],&a[j]); }while(i<=j); swap(&a[i],&a[j]); swap(&a[l],&a[j]); return j; } int Quicksort(int a[10],int m,int n) { int s; if(m...

DAA(Design Analysis & Algorithms) B.tech 6th sem

Image
  Dijkstra’s algorithm 1.       Dijkstra’s algorithm solves the single-source shortest-paths problem on a weighted, directed graph G = (G, v) for the case in which all edge weights are nonnegative. 2.      Dijkstra’s algorithm maintains a set S of vertices whose final shortest-path weights from the source s have already been determined. Initialize Algorithm:- Relax Algoritham:- Example of Relax algorithm Relaxing an edge (u, v) with weight w(u, v)=2.  The shortest-path estimate of each vertex appears within the vertex. a  a)       Because v.d > u.d + w(u, v) prior to relaxation, the value of v.d decreases. b)     b)  Here v.d <=u.d + w(u, v) before relaxing the edge, and so the relaxation step       leaves  v.d unchanged.

Linux and Shell programming ( B.tech 3rd semester)

Image
  Unix ·         Unix  is an Operating System that is truly the base of all Operating Systems like Ubuntu, Solaris, POSIX, etc. ·         Unix operating system is a set of program that play a role as a connection between the computer and the user. ·         It was originally meant for programmers developing software rather than non-programmers. ·         The shell is a command line interpreter. ·         Unix was considered to be the heart of the operating System. The system linux Architecture:- The main concept that combines all the versions of linuix is the following four area: ·         Keranl ·         Shell ·         Command and Utilities ·         Files and Dire...