SlideShare a Scribd company logo
1 of 5
Download to read offline
//bubble sort
#include<iostream.h>
#include<conio.h>
void main ()
{
int a[8] = {22,33,55,44,11,77,11,66};
int k,ptr,temp;
const int n = 8;
clrscr();
for(k=0;k<=n-2;k++)
{
ptr=0;
while (ptr<=n-k-2)
{
if(a[ptr] > a[ptr+1])
{
temp = a[ptr];
a[ptr] = a[ptr+1];
a[ptr+1] = temp;
}
ptr = ptr+1;
}
}
for(k=0;k<=7;k++)
cout<<a[k]<<"t";
getch();
}
// insertion sort
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int array[10],i,j,k,temp, loc;
cout<<"enter the array"<<endl;
for(i=0;i<=9;i++)
cin>>array[i];
//insertion sort logic
for (i=1;i<=9;i++)
{
temp=array[i];
loc=i;
for (j=i;j>=1;j--)
{
if (temp < array[j-1])
{
array[j] = array[j-1];
loc=j-1;
}
else
break;
}
array[loc]=temp;
}
cout<<"sorted arry"<<endl;
for(k=0;k<=9;k++)
cout<<array[k]<<" ";
getch();
}
//sum of two variables( not in salybas)
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,sum;
a=3;
b=5;
sum=a+b;
cout<<"enter the first numbr"<<a;
cin>>a;
cout<<"enter the second number"<<b;
cin>>b;
cout<<"sum is "<<sum;
cin>>sum;
getch();
}
// to find the angle( not in salybas)
#include<iostream.h>
#include<conio.h>
void main()
{
int degree,angle;
cout<<"enter the degree";
cin>>degree;
{
if(degree<90)
cout<<"the angle is = acute angle";
else
if(degree>90)
cout<<"the angle is = obtus angle";
else
if(degree==90)
cout<<"the angle is = right angle";
}
getch();
}
// to find the largest element
#include<iostream.h>
#include<conio.h>
void main ()
{
int k,i,loc,max,a[5];
clrscr();
cout<<"enter the 5 element"<<endl;
for(i=0;i<=4;i++)
cin>>a[i];
k=0;
loc=0;
max=a[0];
while(k<=4)
{
if(max<a[k])
{
loc=k;
max=a[k];
}
k=k++;
}
cout<< "locatin is"<<loc<<" "<<"number is "<<max;
getch();
}
// selection sort
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arry[10],i,j,k,temp;
cout<<"enter the array"<<endl;
for(i=0;i<8;i++)
cin>>arry[i];
for(i=0;i<8;i++)
for(j=i+1;j<8;j++)
if(arry[i] > arry[j])
{
temp = arry[i];
arry[i] = arry[j];
arry[j] = temp;
}
cout<<"sorted arry"<<endl;
for(k=0;k<8;k++)
cout<<arry[k]<<" ";
getch();
}
//linear search
#include<iostream.h>
#include<conio.h>
void main()
{
int item,data[10] = {33,44,55,22,11,66,99,88,77,60},k,loc;
clrscr();
cout<<"enter the value to search"<<endl;
cin>>item;
loc=-1;
k = 0;
while (loc==-1 && k<=9)
{
if(item==data[k])
loc=k;
k = k+1;
}
if(loc==-1)
cout<<"item is not in an array";
else
cout<<loc<<"t"<<"is the location of an item";
getch();
}
// quadric equation
#include<iostream.h>
#include<conio.h>
void main ()
{
int a,b,c,d,x,x1,x2;
clrscr();
cout<<"enter three values"<<endl;
cin>>a>>b>>c;
d= b*b -4*a*c;
if(d>0)
{
x1=(-b+d^(1/2));
x2=(-b-d^(1/2));
cout<<x1<<"t"<<x2;
}
else
if(d==0)
{
x=-b/2*a;
cout<<"uniqe solution"<<x;
}
else
cout<<"no real soltuion";
getch();
}

More Related Content

What's hot

Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseSages
 
Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Steffen Wenz
 
Doubly linklist
Doubly linklistDoubly linklist
Doubly linklistilsamaryum
 
Меняем javascript с помощью javascript
Меняем javascript с помощью javascriptМеняем javascript с помощью javascript
Меняем javascript с помощью javascriptPavel Volokitin
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopSages
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesTeerawat Issariyakul
 
Grand centraldispatch
Grand centraldispatchGrand centraldispatch
Grand centraldispatchYuumi Yoshida
 
To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2Bahul Neel Upadhyaya
 
Cluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeCluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeSteffen Wenz
 
Understanding the nodejs event loop
Understanding the nodejs event loopUnderstanding the nodejs event loop
Understanding the nodejs event loopSaurabh Kumar
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in ActionAlexander Kachur
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socketPhilip Zhong
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testingPhilip Zhong
 
The Ring programming language version 1.3 book - Part 48 of 88
The Ring programming language version 1.3 book - Part 48 of 88The Ring programming language version 1.3 book - Part 48 of 88
The Ring programming language version 1.3 book - Part 48 of 88Mahmoud Samir Fayed
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3Simon Su
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Philip Zhong
 

What's hot (20)

Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016
 
Doubly linklist
Doubly linklistDoubly linklist
Doubly linklist
 
Меняем javascript с помощью javascript
Меняем javascript с помощью javascriptМеняем javascript с помощью javascript
Меняем javascript с помощью javascript
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
NS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variablesNS2: Binding C++ and OTcl variables
NS2: Binding C++ and OTcl variables
 
Grand centraldispatch
Grand centraldispatchGrand centraldispatch
Grand centraldispatch
 
To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2To Infinity & Beyond: Protocols & sequences in Node - Part 2
To Infinity & Beyond: Protocols & sequences in Node - Part 2
 
Cluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in PracticeCluj Big Data Meetup - Big Data in Practice
Cluj Big Data Meetup - Big Data in Practice
 
Understanding the nodejs event loop
Understanding the nodejs event loopUnderstanding the nodejs event loop
Understanding the nodejs event loop
 
Aa
AaAa
Aa
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socket
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testing
 
The Ring programming language version 1.3 book - Part 48 of 88
The Ring programming language version 1.3 book - Part 48 of 88The Ring programming language version 1.3 book - Part 48 of 88
The Ring programming language version 1.3 book - Part 48 of 88
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
Problemas de Arreglos en c++
Problemas de Arreglos en c++Problemas de Arreglos en c++
Problemas de Arreglos en c++
 
3 rd animation
3 rd animation3 rd animation
3 rd animation
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8
 

Similar to Data structure programs in c++

Microsoft Word Hw#1
Microsoft Word   Hw#1Microsoft Word   Hw#1
Microsoft Word Hw#1kkkseld
 
I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfshreeaadithyaacellso
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYMalikireddy Bramhananda Reddy
 
Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPGFrankDin1
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleIan Barber
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and PolynomialAroosa Rajput
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...Andrey Karpov
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Platonov Sergey
 

Similar to Data structure programs in c++ (20)

Ds 2 cycle
Ds 2 cycleDs 2 cycle
Ds 2 cycle
 
Microsoft Word Hw#1
Microsoft Word   Hw#1Microsoft Word   Hw#1
Microsoft Word Hw#1
 
Snake.c
Snake.cSnake.c
Snake.c
 
C# Assignmet Help
C# Assignmet HelpC# Assignmet Help
C# Assignmet Help
 
Sortings
SortingsSortings
Sortings
 
Rkf
RkfRkf
Rkf
 
Asssignment2
Asssignment2 Asssignment2
Asssignment2
 
I have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdfI have written the code but cannot complete the assignment please help.pdf
I have written the code but cannot complete the assignment please help.pdf
 
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDYDATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
DATASTRUCTURES PPTS PREPARED BY M V BRAHMANANDA REDDY
 
Oops lab manual
Oops lab manualOops lab manual
Oops lab manual
 
Cpp programs
Cpp programsCpp programs
Cpp programs
 
C program
C programC program
C program
 
Senior design project code for PPG
Senior design project code for PPGSenior design project code for PPG
Senior design project code for PPG
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and Polynomial
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 
Exp3
Exp3Exp3
Exp3
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...
 
Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.Евгений Крутько, Многопоточные вычисления, современный подход.
Евгений Крутько, Многопоточные вычисления, современный подход.
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Data structure programs in c++

  • 1. //bubble sort #include<iostream.h> #include<conio.h> void main () { int a[8] = {22,33,55,44,11,77,11,66}; int k,ptr,temp; const int n = 8; clrscr(); for(k=0;k<=n-2;k++) { ptr=0; while (ptr<=n-k-2) { if(a[ptr] > a[ptr+1]) { temp = a[ptr]; a[ptr] = a[ptr+1]; a[ptr+1] = temp; } ptr = ptr+1; } } for(k=0;k<=7;k++) cout<<a[k]<<"t"; getch(); } // insertion sort #include<iostream.h> #include<conio.h> void main() { clrscr(); int array[10],i,j,k,temp, loc; cout<<"enter the array"<<endl; for(i=0;i<=9;i++) cin>>array[i]; //insertion sort logic for (i=1;i<=9;i++) { temp=array[i];
  • 2. loc=i; for (j=i;j>=1;j--) { if (temp < array[j-1]) { array[j] = array[j-1]; loc=j-1; } else break; } array[loc]=temp; } cout<<"sorted arry"<<endl; for(k=0;k<=9;k++) cout<<array[k]<<" "; getch(); } //sum of two variables( not in salybas) #include<iostream.h> #include<conio.h> void main() { int a,b,sum; a=3; b=5; sum=a+b; cout<<"enter the first numbr"<<a; cin>>a; cout<<"enter the second number"<<b; cin>>b; cout<<"sum is "<<sum; cin>>sum; getch(); } // to find the angle( not in salybas) #include<iostream.h> #include<conio.h> void main() { int degree,angle; cout<<"enter the degree"; cin>>degree;
  • 3. { if(degree<90) cout<<"the angle is = acute angle"; else if(degree>90) cout<<"the angle is = obtus angle"; else if(degree==90) cout<<"the angle is = right angle"; } getch(); } // to find the largest element #include<iostream.h> #include<conio.h> void main () { int k,i,loc,max,a[5]; clrscr(); cout<<"enter the 5 element"<<endl; for(i=0;i<=4;i++) cin>>a[i]; k=0; loc=0; max=a[0]; while(k<=4) { if(max<a[k]) { loc=k; max=a[k]; } k=k++; } cout<< "locatin is"<<loc<<" "<<"number is "<<max; getch(); } // selection sort #include<iostream.h> #include<conio.h> void main() { clrscr(); int arry[10],i,j,k,temp;
  • 4. cout<<"enter the array"<<endl; for(i=0;i<8;i++) cin>>arry[i]; for(i=0;i<8;i++) for(j=i+1;j<8;j++) if(arry[i] > arry[j]) { temp = arry[i]; arry[i] = arry[j]; arry[j] = temp; } cout<<"sorted arry"<<endl; for(k=0;k<8;k++) cout<<arry[k]<<" "; getch(); } //linear search #include<iostream.h> #include<conio.h> void main() { int item,data[10] = {33,44,55,22,11,66,99,88,77,60},k,loc; clrscr(); cout<<"enter the value to search"<<endl; cin>>item; loc=-1; k = 0; while (loc==-1 && k<=9) { if(item==data[k]) loc=k; k = k+1; } if(loc==-1) cout<<"item is not in an array"; else cout<<loc<<"t"<<"is the location of an item"; getch(); } // quadric equation #include<iostream.h> #include<conio.h> void main () { int a,b,c,d,x,x1,x2;
  • 5. clrscr(); cout<<"enter three values"<<endl; cin>>a>>b>>c; d= b*b -4*a*c; if(d>0) { x1=(-b+d^(1/2)); x2=(-b-d^(1/2)); cout<<x1<<"t"<<x2; } else if(d==0) { x=-b/2*a; cout<<"uniqe solution"<<x; } else cout<<"no real soltuion"; getch(); }