SlideShare a Scribd company logo
1.Program for search an element by using linearsearch
algorithm.
#include <stdio.h>
#include<conio.h>
int main()
{
int array[100], search, c, n;
printf("Enter the number of elements in arrayn");
scanf("%d",&n);
printf("Enter %d integer(s)n", n);
for (c = 0; c < n; c++)
scanf("%d", &array[c]);
printf("Enter the number to searchn");
scanf("%d", &search);
for (c = 0; c < n; c++)
{
if (array[c] == search) /* if required element found */
{
printf("%d is present at location %d.n", search, c+1);
break;
}
}
if (c == n)
printf("%d is not present in array.n", search);
getch();
}
OUTPUT-
2.Program for search an element by using binary search
algorithm.
#include <stdio.h>
#include<conio.h>
int main()
{
int c, first, last, middle, n, search, array[100];
printf("Enter number of elementsn");
scanf("%d",&n);
printf("Enter %d integersn", n);
for (c = 0; c < n; c++)
scanf("%d",&array[c]);
printf("Enter value to findn");
scanf("%d", &search);
first = 0;
last = n - 1;
middle = (first+last)/2;
while (first <= last) {
if (array[middle] < search)
first = middle + 1;
else if (array[middle] == search) {
printf("%d found at location %d.n", search, middle+1);
break;
}
else
last = middle - 1;
middle = (first + last)/2;
}
if (first > last)
printf("Not found! %d is not present in the list.n", search);
getch();
}
OUTPUT-
3.Program of sorting elements by using merge sort algorithm.
#include <stdio.h>
#include <conio.h>
int main( )
{
int a[5] = { 11, 2, 9, 13, 57 } ;
int b[5] = { 25, 17, 1, 90, 3 } ;
int c[10] ;
int i, j, k, temp ;
printf ( "Merge sort.n" ) ;
printf ( "nFirst array:n" ) ;
for ( i = 0 ; i <= 4 ; i++ )
printf ( "%dt", a[i] ) ;
printf ( "nnSecond array:n" ) ;
for ( i = 0 ; i <= 4 ; i++ )
printf ( "%dt", b[i] ) ;
for ( i = 0 ; i <= 3 ; i++ )
{
for ( j = i + 1 ; j <= 4 ; j++ )
{
if ( a[i] > a[j] )
{
temp = a[i] ;
a[i] = a[j] ;
a[j] = temp ;
}
if ( b[i] > b[j] )
{
temp = b[i] ;
b[i] = b[j] ;
b[j] = temp ;
}
}
}
for ( i = j = k = 0 ; i <= 9 ; )
{
if ( a[j] <= b[k] )
c[i++] = a[j++] ;
else
c[i++] = b[k++] ;
if ( j == 5 || k == 5 )
break ;
}
for ( ; j <= 4 ; )
c[i++] = a[j++] ;
for ( ; k <= 4 ; )
c[i++] = b[k++] ;
printf ( "nnArray after sorting:n") ;
for ( i = 0 ; i <= 9 ; i++ )
printf ( "%dt", c[i] ) ;
getch( ) ;
}
OUTPUT-
4.Program of sorting elements by using quick sort algorithm.
#include<stdio.h>
#include<conio.h>
void quicksort(int [10],int,int);
int main(){
int x[20],size,i;
printf("Enter size of the array: ");
scanf("%d",&size);
printf("Enter %d elements: ",size);
for(i=0;i<size;i++)
scanf("%d",&x[i]);
quicksort(x,0,size-1);
printf("Sorted elements: ");
for(i=0;i<size;i++)
printf(" %d",x[i]);
return 0;
}
void quicksort(int x[10],int first,int last){
int pivot,j,temp,i;
if(first<last){
pivot=first;
i=first;
j=last;
while(i<j){
while(x[i]<=x[pivot]&&i<last)
i++;
while(x[j]>x[pivot])
j--;
if(i<j){
temp=x[i];
x[i]=x[j];
x[j]=temp;
}
}
temp=x[pivot];
x[pivot]=x[j];
x[j]=temp;
quicksort(x,first,j-1);
quicksort(x,j+1,last);
}
getch();
}
OUTPUT-
5.Program of sorting elements by using selection sort
algorithm.
#include <stdio.h>
#include<conio.h>
int main()
{
int array[100], n, c, d, position, swap;
printf("Enter number of elementsn");
scanf("%d", &n);
printf("Enter %d integersn", n);
for ( c = 0 ; c < n ; c++ )
scanf("%d", &array[c]);
for ( c = 0 ; c < ( n - 1 ) ; c++ )
{
position = c;
for ( d = c + 1 ; d < n ; d++ )
{
if ( array[position] > array[d] )
position = d;
}
if ( position != c )
{
swap = array[c];
array[c] = array[position];
array[position] = swap;
}
}
printf("Sorted list in ascending order:n");
for ( c = 0 ; c < n ; c++ )
printf("%dn", array[c]);
getch();
}
OUTPUT-
6.Program of sorting elements by using bubble sort algorithm.
#include<stdio.h>
#include<conio.h>
int main()
{
int s,temp,i,j,a[20];
printf("Enter total numbers of elements: ");
scanf("%d",&s);
printf("Enter %d elements: ",s);
for(i=0;i<s;i++)
scanf("%d",&a[i]);
//Bubble sorting algorithm
for(i=s-2;i>=0;i--){
for(j=0;j<=i;j++){
if(a[j]>a[j+1]){
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
printf("After sorting: ");
for(i=0;i<s;i++)
printf(" %d",a[i]);
getch();
}
OUTPUT-
7.Stack implementationusing array.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define size 5
struct stack {
int s[size];
int top;
} st;
int stfull() {
if (st.top >= size - 1)
return 1;
else
return 0;
}
void push(int item) {
st.top++;
st.s[st.top] = item;
}
int stempty() {
if (st.top == -1)
return 1;
else
return 0;
}
int pop() {
int item;
item = st.s[st.top];
st.top--;
return (item);
}
void display() {
int i;
if (stempty())
printf("nStack Is Empty!");
else {
for (i = st.top; i >= 0; i--)
printf("n%d", st.s[i]);
}
}
int main() {
int item, choice;
char ans;
st.top = -1;
printf("ntImplementation Of Stack");
do {
printf("nMain Menu");
printf("n1.Push n2.Pop n3.Display n4.exit");
printf("nEnter Your Choice");
scanf("%d", &choice);
switch (choice) {
case 1:
printf("nEnter The item to be pushed");
scanf("%d", &item);
if (stfull())
printf("nStack is Full!");
else
push(item);
break;
case 2:
if (stempty())
printf("nEmpty stack!Underflow !!");
else {
item = pop();
printf("nThe popped element is %d", item);
}
break;
case 3:
display();
break;
case 4:
exit(0);
}
printf("nDo You want To Continue?");
ans = getche();
} while (ans == 'Y' || ans == 'y');
getch();
}
OUTPUT-
8.Program to displayFibonacciseries using recursion.
#include<stdio.h>
#include<conio.h>
void printFibonacci(int);
int main(){
int k,n;
long int i=0,j=1,f;
printf("Enter the range of the Fibonacci series: ");
scanf("%d",&n);
printf("Fibonacci Series: ");
printf("%d %d ",0,1);
printFibonacci(n);
return 0;
}
void printFibonacci(int n){
static long int first=0,second=1,sum;
if(n>0){
sum = first + second;
first = second;
second = sum;
printf("%ld ",sum);
printFibonacci(n-1);
}
getch();
}
OUTPUT-
9.Queue implementationusing array.
#include<stdio.h>
#include<conio.h>
#define MAX 10
void insert(int);
int del();
int queue[MAX], rear=0, front=0;
void display();
int main()
{
char ch , a='y';
int choice, token;
printf("1.Insert");
printf("n2.Delete");
printf("n3.show or display");
do
{
printf("nEnter your choice for the operation: ");
scanf("%d",&choice);
switch(choice)
{
case 1: insert(token);
display();
break;
token=del();
printf("nThe token deleted is %d",token);
display();
break;
case 3:
display();
break;
default:
printf("Wrong choice");
break;
}
printf("nDo you want to continue(y/n):");
ch=getch();
}
while(ch=='y'||ch=='Y');
getch();
}
void display()
{
int i;
printf("nThe queue elements are:");
for(i=rear;i<front;i++)
{
printf("%d ",queue[i]);
}
}
void insert(int token)
{
char a;
if(rear==MAX)
{
printf("nQueue full");
return;
}
do
{
printf("nEnter the token to be inserted:");
scanf("%d",&token);
queue[front]=token;
front=front+1;
printf("do you want to continue insertion Y/N");
a=getch();
}
while(a=='y');
}
int del()
{
int t;
if(front==rear)
{
printf("nQueue empty");
return 0;
}
rear=rear+1;
t=queue[rear-1];
return t;
}
OUTPUT-
10.Program for insertion, deletion,displayand traversal in
binary search tree.
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
void insert(int,int );
void delte(int);
void display(int);
int search(int);
int search1(int,int);
int tree[40],t=1,s,x,i;
main()
{
int ch,y;
for(i=1;i<40;i++)
tree[i]=-1;
while(1)
{
cout <<"1.INSERTn2.DELETEn3.DISPLAYn4.SEARCHn5.EXITnEnter your choice:";
cin >> ch;
switch(ch)
{
case 1:
cout <<"enter the element to insert";
cin >> ch;
insert(1,ch);
break;
case 2:
cout <<"enter the element to delete";
cin >>x;
y=search(1);
if(y!=-1) delte(y);
else cout<<"no such element in tree";
break;
case 3:
display(1);
cout<<"n";
for(int i=0;i<=32;i++)
cout <<i;
cout <<"n";
break;
case 4:
cout <<"enter the element to search:";
cin >> x;
y=search(1);
if(y == -1) cout <<"no such element in tree";
else cout <<x << "is in" <<y <<"position";
break;
case 5:
exit(0);
}
}
}
void insert(int s,int ch )
{
int x;
if(t==1)
{
tree[t++]=ch;
return;
}
x=search1(s,ch);
if(tree[x]>ch)
tree[2*x]=ch;
else
tree[2*x+1]=ch;
t++;
}
void delte(int x)
{
if( tree[2*x]==-1 && tree[2*x+1]==-1)
tree[x]=-1;
else if(tree[2*x]==-1)
{ tree[x]=tree[2*x+1];
tree[2*x+1]=-1;
}
else if(tree[2*x+1]==-1)
{ tree[x]=tree[2*x];
tree[2*x]=-1;
}
else
{
tree[x]=tree[2*x];
delte(2*x);
}
t--;
}
int search(int s)
{
if(t==1)
{
cout <<"no element in tree";
return -1;
}
if(tree[s]==-1)
return tree[s];
if(tree[s]>x)
search(2*s);
else if(tree[s]<x)
search(2*s+1);
else
return s;
}
void display(int s)
{
if(t==1)
{cout <<"no element in tree:";
return;}
for(int i=1;i<40;i++)
if(tree[i]==-1)
cout <<" ";
else cout <<tree[i];
return ;
}
int search1(int s,int ch)
{
if(t==1)
{
cout <<"no element in tree";
return -1;
}
if(tree[s]==-1)
return s/2;
if(tree[s] > ch)
search1(2*s,ch);
else search1(2*s+1,ch);
}
OUTPUT-

More Related Content

What's hot

Daa practicals
Daa practicalsDaa practicals
Daa practicals
Rekha Yadav
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
argusacademy
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
Lakshmi Sarvani Videla
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
Sazzad Hossain, ITP, MBA, CSCA™
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)vinay arora
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
Balaji Thala
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
vrgokila
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
sandeep kumbhkar
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
Harjinder Singh
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programs
Kandarp Tiwari
 
C file
C fileC file
Datastructures asignment
Datastructures asignmentDatastructures asignment
Datastructures asignmentsreekanth3dce
 
Double linked list
Double linked listDouble linked list
Double linked list
raviahuja11
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
Chhom Karath
 
Ada file
Ada fileAda file
Ada file
Kumar Gaurav
 

What's hot (20)

C lab manaual
C lab manaualC lab manaual
C lab manaual
 
Daa practicals
Daa practicalsDaa practicals
Daa practicals
 
C programming array & shorting
C  programming array & shortingC  programming array & shorting
C programming array & shorting
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
 
C Prog - Array
C Prog - ArrayC Prog - Array
C Prog - Array
 
C Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossainC Programming Exam problems & Solution by sazzad hossain
C Programming Exam problems & Solution by sazzad hossain
 
C Prog. - Strings (Updated)
C Prog. - Strings (Updated)C Prog. - Strings (Updated)
C Prog. - Strings (Updated)
 
C programs
C programsC programs
C programs
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
 
Os lab file c programs
Os lab file c programsOs lab file c programs
Os lab file c programs
 
C file
C fileC file
C file
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Datastructures asignment
Datastructures asignmentDatastructures asignment
Datastructures asignment
 
Double linked list
Double linked listDouble linked list
Double linked list
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
 
Ada file
Ada fileAda file
Ada file
 
C PROGRAMS
C PROGRAMSC PROGRAMS
C PROGRAMS
 

Viewers also liked

information diet
information dietinformation diet
information diet
Mesut Cura
 
LibGuides 2 Team Meeting - April 22, 2015
LibGuides 2 Team Meeting - April 22, 2015LibGuides 2 Team Meeting - April 22, 2015
LibGuides 2 Team Meeting - April 22, 2015
Elizabeth German
 
Ümran sunum new 2
Ümran sunum new 2Ümran sunum new 2
Ümran sunum new 2enesummu
 
La amistad......
La amistad......La amistad......
La amistad......
Perlita Vargas
 
George &amp; aina g
George &amp; aina gGeorge &amp; aina g
George &amp; aina g
jordiidkyes
 
Planning images
Planning imagesPlanning images
Planning images
erneststaszak
 
Programma completo palermo apre le porte
Programma completo palermo apre le porteProgramma completo palermo apre le porte
Programma completo palermo apre le porteViviana Monaco
 
บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...
บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...
บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...
สอบครูดอทคอม เว็บเตรียมสอบ
 
Daniel R.P actual
Daniel R.P actualDaniel R.P actual
Daniel R.P actualDanno Piiio
 
Aprenda a Lançar
Aprenda a LançarAprenda a Lançar
Aprenda a Lançar
gabrielwelter
 
Presentació english
Presentació english Presentació english
Presentació english
marius_martinez
 
Promoting the Role of Government in Child Well-Being
Promoting the Role of Government in Child Well-BeingPromoting the Role of Government in Child Well-Being
Promoting the Role of Government in Child Well-Being
PublicWorks
 
Marina's song
Marina's songMarina's song
Marina's song
marinamelendez15
 

Viewers also liked (20)

Showcase
ShowcaseShowcase
Showcase
 
Questionnaire research
Questionnaire researchQuestionnaire research
Questionnaire research
 
information diet
information dietinformation diet
information diet
 
LibGuides 2 Team Meeting - April 22, 2015
LibGuides 2 Team Meeting - April 22, 2015LibGuides 2 Team Meeting - April 22, 2015
LibGuides 2 Team Meeting - April 22, 2015
 
Ümran sunum new 2
Ümran sunum new 2Ümran sunum new 2
Ümran sunum new 2
 
La amistad......
La amistad......La amistad......
La amistad......
 
Final Grant
Final GrantFinal Grant
Final Grant
 
George &amp; aina g
George &amp; aina gGeorge &amp; aina g
George &amp; aina g
 
MH Resume 042115
MH Resume 042115MH Resume 042115
MH Resume 042115
 
Planning images
Planning imagesPlanning images
Planning images
 
Programma completo palermo apre le porte
Programma completo palermo apre le porteProgramma completo palermo apre le porte
Programma completo palermo apre le porte
 
R m g
R m gR m g
R m g
 
MCT_CERTIFICATE_Livingston
MCT_CERTIFICATE_LivingstonMCT_CERTIFICATE_Livingston
MCT_CERTIFICATE_Livingston
 
บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...
บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...
บ้านสอบครู (อ.บวร) บรรยายการบริหารงานในหน้าที่และกฎหมายปฏิบัติราชการสำหรับผู้...
 
Daniel R.P actual
Daniel R.P actualDaniel R.P actual
Daniel R.P actual
 
Aprenda a Lançar
Aprenda a LançarAprenda a Lançar
Aprenda a Lançar
 
Presentació english
Presentació english Presentació english
Presentació english
 
T p1 ernesto vega
T p1 ernesto vegaT p1 ernesto vega
T p1 ernesto vega
 
Promoting the Role of Government in Child Well-Being
Promoting the Role of Government in Child Well-BeingPromoting the Role of Government in Child Well-Being
Promoting the Role of Government in Child Well-Being
 
Marina's song
Marina's songMarina's song
Marina's song
 

Similar to ADA FILE

Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Er Ritu Aggarwal
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
Syed Tanveer
 
C Programming Language Part 8
C Programming Language Part 8C Programming Language Part 8
C Programming Language Part 8
Rumman Ansari
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
Arkadeep Dey
 
C programs
C programsC programs
C programs
Koshy Geoji
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
Prof. Dr. K. Adisesha
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
 
C programms
C programmsC programms
C programms
Mukund Gandrakota
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
PRATHAMESH DESHPANDE
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
Hazrat Bilal
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
KavyaSharma65
 
C basics
C basicsC basics
C basicsMSc CST
 
programs on arrays.pdf
programs on arrays.pdfprograms on arrays.pdf
programs on arrays.pdf
sowmya koneru
 
Arrays
ArraysArrays
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointersvinay arora
 
C file
C fileC file
C tech questions
C tech questionsC tech questions
C tech questions
vijay00791
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
Koshy Geoji
 

Similar to ADA FILE (20)

Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
Ds
DsDs
Ds
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
C Programming Language Part 8
C Programming Language Part 8C Programming Language Part 8
C Programming Language Part 8
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
C programs
C programsC programs
C programs
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
C programms
C programmsC programms
C programms
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
Let us C (by yashvant Kanetkar) chapter 3 Solution
Let us C   (by yashvant Kanetkar) chapter 3 SolutionLet us C   (by yashvant Kanetkar) chapter 3 Solution
Let us C (by yashvant Kanetkar) chapter 3 Solution
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
 
C basics
C basicsC basics
C basics
 
programs on arrays.pdf
programs on arrays.pdfprograms on arrays.pdf
programs on arrays.pdf
 
Arrays
ArraysArrays
Arrays
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
C file
C fileC file
C file
 
C tech questions
C tech questionsC tech questions
C tech questions
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 

More from Gaurav Singh

Oral presentation
Oral presentationOral presentation
Oral presentation
Gaurav Singh
 
srgoc dotnet_ppt
srgoc dotnet_pptsrgoc dotnet_ppt
srgoc dotnet_ppt
Gaurav Singh
 
Srgoc dotnet_new
Srgoc dotnet_newSrgoc dotnet_new
Srgoc dotnet_new
Gaurav Singh
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
Gaurav Singh
 
srgoc
srgocsrgoc
Srgoc linux
Srgoc linuxSrgoc linux
Srgoc linux
Gaurav Singh
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
Gaurav Singh
 
cs506_linux
cs506_linuxcs506_linux
cs506_linux
Gaurav Singh
 

More from Gaurav Singh (8)

Oral presentation
Oral presentationOral presentation
Oral presentation
 
srgoc dotnet_ppt
srgoc dotnet_pptsrgoc dotnet_ppt
srgoc dotnet_ppt
 
Srgoc dotnet_new
Srgoc dotnet_newSrgoc dotnet_new
Srgoc dotnet_new
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
srgoc
srgocsrgoc
srgoc
 
Srgoc linux
Srgoc linuxSrgoc linux
Srgoc linux
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
 
cs506_linux
cs506_linuxcs506_linux
cs506_linux
 

Recently uploaded

CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 

Recently uploaded (20)

CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 

ADA FILE

  • 1. 1.Program for search an element by using linearsearch algorithm. #include <stdio.h> #include<conio.h> int main() { int array[100], search, c, n; printf("Enter the number of elements in arrayn"); scanf("%d",&n); printf("Enter %d integer(s)n", n); for (c = 0; c < n; c++) scanf("%d", &array[c]); printf("Enter the number to searchn"); scanf("%d", &search); for (c = 0; c < n; c++) { if (array[c] == search) /* if required element found */ { printf("%d is present at location %d.n", search, c+1); break; } } if (c == n) printf("%d is not present in array.n", search);
  • 3. 2.Program for search an element by using binary search algorithm. #include <stdio.h> #include<conio.h> int main() { int c, first, last, middle, n, search, array[100]; printf("Enter number of elementsn"); scanf("%d",&n); printf("Enter %d integersn", n); for (c = 0; c < n; c++) scanf("%d",&array[c]); printf("Enter value to findn"); scanf("%d", &search); first = 0; last = n - 1; middle = (first+last)/2; while (first <= last) { if (array[middle] < search) first = middle + 1; else if (array[middle] == search) { printf("%d found at location %d.n", search, middle+1); break; }
  • 4. else last = middle - 1; middle = (first + last)/2; } if (first > last) printf("Not found! %d is not present in the list.n", search); getch(); } OUTPUT-
  • 5. 3.Program of sorting elements by using merge sort algorithm. #include <stdio.h> #include <conio.h> int main( ) { int a[5] = { 11, 2, 9, 13, 57 } ; int b[5] = { 25, 17, 1, 90, 3 } ; int c[10] ; int i, j, k, temp ; printf ( "Merge sort.n" ) ; printf ( "nFirst array:n" ) ; for ( i = 0 ; i <= 4 ; i++ ) printf ( "%dt", a[i] ) ; printf ( "nnSecond array:n" ) ; for ( i = 0 ; i <= 4 ; i++ ) printf ( "%dt", b[i] ) ; for ( i = 0 ; i <= 3 ; i++ ) { for ( j = i + 1 ; j <= 4 ; j++ ) { if ( a[i] > a[j] ) { temp = a[i] ; a[i] = a[j] ;
  • 6. a[j] = temp ; } if ( b[i] > b[j] ) { temp = b[i] ; b[i] = b[j] ; b[j] = temp ; } } } for ( i = j = k = 0 ; i <= 9 ; ) { if ( a[j] <= b[k] ) c[i++] = a[j++] ; else c[i++] = b[k++] ; if ( j == 5 || k == 5 ) break ; } for ( ; j <= 4 ; ) c[i++] = a[j++] ; for ( ; k <= 4 ; ) c[i++] = b[k++] ; printf ( "nnArray after sorting:n") ;
  • 7. for ( i = 0 ; i <= 9 ; i++ ) printf ( "%dt", c[i] ) ; getch( ) ; } OUTPUT-
  • 8. 4.Program of sorting elements by using quick sort algorithm. #include<stdio.h> #include<conio.h> void quicksort(int [10],int,int); int main(){ int x[20],size,i; printf("Enter size of the array: "); scanf("%d",&size); printf("Enter %d elements: ",size); for(i=0;i<size;i++) scanf("%d",&x[i]); quicksort(x,0,size-1); printf("Sorted elements: "); for(i=0;i<size;i++) printf(" %d",x[i]); return 0; } void quicksort(int x[10],int first,int last){ int pivot,j,temp,i; if(first<last){ pivot=first; i=first; j=last; while(i<j){
  • 11. 5.Program of sorting elements by using selection sort algorithm. #include <stdio.h> #include<conio.h> int main() { int array[100], n, c, d, position, swap; printf("Enter number of elementsn"); scanf("%d", &n); printf("Enter %d integersn", n); for ( c = 0 ; c < n ; c++ ) scanf("%d", &array[c]); for ( c = 0 ; c < ( n - 1 ) ; c++ ) { position = c; for ( d = c + 1 ; d < n ; d++ ) { if ( array[position] > array[d] ) position = d; } if ( position != c ) { swap = array[c]; array[c] = array[position];
  • 12. array[position] = swap; } } printf("Sorted list in ascending order:n"); for ( c = 0 ; c < n ; c++ ) printf("%dn", array[c]); getch(); } OUTPUT-
  • 13. 6.Program of sorting elements by using bubble sort algorithm. #include<stdio.h> #include<conio.h> int main() { int s,temp,i,j,a[20]; printf("Enter total numbers of elements: "); scanf("%d",&s); printf("Enter %d elements: ",s); for(i=0;i<s;i++) scanf("%d",&a[i]); //Bubble sorting algorithm for(i=s-2;i>=0;i--){ for(j=0;j<=i;j++){ if(a[j]>a[j+1]){ temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } printf("After sorting: "); for(i=0;i<s;i++) printf(" %d",a[i]);
  • 15. 7.Stack implementationusing array. #include<stdio.h> #include<conio.h> #include<stdlib.h> #define size 5 struct stack { int s[size]; int top; } st; int stfull() { if (st.top >= size - 1) return 1; else return 0; } void push(int item) { st.top++; st.s[st.top] = item; } int stempty() { if (st.top == -1) return 1; else return 0;
  • 16. } int pop() { int item; item = st.s[st.top]; st.top--; return (item); } void display() { int i; if (stempty()) printf("nStack Is Empty!"); else { for (i = st.top; i >= 0; i--) printf("n%d", st.s[i]); } } int main() { int item, choice; char ans; st.top = -1; printf("ntImplementation Of Stack"); do { printf("nMain Menu"); printf("n1.Push n2.Pop n3.Display n4.exit");
  • 17. printf("nEnter Your Choice"); scanf("%d", &choice); switch (choice) { case 1: printf("nEnter The item to be pushed"); scanf("%d", &item); if (stfull()) printf("nStack is Full!"); else push(item); break; case 2: if (stempty()) printf("nEmpty stack!Underflow !!"); else { item = pop(); printf("nThe popped element is %d", item); } break; case 3: display(); break; case 4: exit(0);
  • 18. } printf("nDo You want To Continue?"); ans = getche(); } while (ans == 'Y' || ans == 'y'); getch(); } OUTPUT-
  • 19. 8.Program to displayFibonacciseries using recursion. #include<stdio.h> #include<conio.h> void printFibonacci(int); int main(){ int k,n; long int i=0,j=1,f; printf("Enter the range of the Fibonacci series: "); scanf("%d",&n); printf("Fibonacci Series: "); printf("%d %d ",0,1); printFibonacci(n); return 0; } void printFibonacci(int n){ static long int first=0,second=1,sum; if(n>0){ sum = first + second; first = second; second = sum; printf("%ld ",sum); printFibonacci(n-1); } getch();
  • 21. 9.Queue implementationusing array. #include<stdio.h> #include<conio.h> #define MAX 10 void insert(int); int del(); int queue[MAX], rear=0, front=0; void display(); int main() { char ch , a='y'; int choice, token; printf("1.Insert"); printf("n2.Delete"); printf("n3.show or display"); do { printf("nEnter your choice for the operation: "); scanf("%d",&choice); switch(choice) { case 1: insert(token); display(); break;
  • 22. token=del(); printf("nThe token deleted is %d",token); display(); break; case 3: display(); break; default: printf("Wrong choice"); break; } printf("nDo you want to continue(y/n):"); ch=getch(); } while(ch=='y'||ch=='Y'); getch(); } void display() { int i; printf("nThe queue elements are:"); for(i=rear;i<front;i++) { printf("%d ",queue[i]);
  • 23. } } void insert(int token) { char a; if(rear==MAX) { printf("nQueue full"); return; } do { printf("nEnter the token to be inserted:"); scanf("%d",&token); queue[front]=token; front=front+1; printf("do you want to continue insertion Y/N"); a=getch(); } while(a=='y'); } int del() { int t;
  • 25. 10.Program for insertion, deletion,displayand traversal in binary search tree. #include<iostream> #include<conio.h> #include<stdlib.h> using namespace std; void insert(int,int ); void delte(int); void display(int); int search(int); int search1(int,int); int tree[40],t=1,s,x,i; main() { int ch,y; for(i=1;i<40;i++) tree[i]=-1; while(1) { cout <<"1.INSERTn2.DELETEn3.DISPLAYn4.SEARCHn5.EXITnEnter your choice:"; cin >> ch; switch(ch) { case 1:
  • 26. cout <<"enter the element to insert"; cin >> ch; insert(1,ch); break; case 2: cout <<"enter the element to delete"; cin >>x; y=search(1); if(y!=-1) delte(y); else cout<<"no such element in tree"; break; case 3: display(1); cout<<"n"; for(int i=0;i<=32;i++) cout <<i; cout <<"n"; break; case 4: cout <<"enter the element to search:"; cin >> x; y=search(1); if(y == -1) cout <<"no such element in tree"; else cout <<x << "is in" <<y <<"position";
  • 27. break; case 5: exit(0); } } } void insert(int s,int ch ) { int x; if(t==1) { tree[t++]=ch; return; } x=search1(s,ch); if(tree[x]>ch) tree[2*x]=ch; else tree[2*x+1]=ch; t++; } void delte(int x) {
  • 28. if( tree[2*x]==-1 && tree[2*x+1]==-1) tree[x]=-1; else if(tree[2*x]==-1) { tree[x]=tree[2*x+1]; tree[2*x+1]=-1; } else if(tree[2*x+1]==-1) { tree[x]=tree[2*x]; tree[2*x]=-1; } else { tree[x]=tree[2*x]; delte(2*x); } t--; } int search(int s) { if(t==1) { cout <<"no element in tree"; return -1; }
  • 29. if(tree[s]==-1) return tree[s]; if(tree[s]>x) search(2*s); else if(tree[s]<x) search(2*s+1); else return s; } void display(int s) { if(t==1) {cout <<"no element in tree:"; return;} for(int i=1;i<40;i++) if(tree[i]==-1) cout <<" "; else cout <<tree[i]; return ; } int search1(int s,int ch) { if(t==1) {
  • 30. cout <<"no element in tree"; return -1; } if(tree[s]==-1) return s/2; if(tree[s] > ch) search1(2*s,ch); else search1(2*s+1,ch); } OUTPUT-