SlideShare a Scribd company logo
Insertin
int main()
{ int
a[16],i,j,k,temp,n;
cout<<"enter
number of
elements ";
cin>>n;
cout<<"enter the
elementsn";
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=1;i<n;i++)
{
for(j=i;j>=1;j--)
{
if(a[j]<a[j-1])
{
temp=a[j];
a[j]=a[j-1];
a[j-1]=temp;
}
else
break;
}
}
cout<<"sorted
arrayn"<<endl;
for(k=0;k<n;k++)
{
cout<<a[k]<<endl;
}
return 0;
}
Selection
int main()
{
int data[10],temp,i,n;
cout<<"Enter number of
elementsn";
cin>>n;
cout<<"Enter integersn";
for (i = 0; i < n; i++)
cin>>data[i];
for(int i=0;i<n-1;i++)
for(int j=i+1;j<n;j++)
if(data[i]<data[j])
{
temp=data[i];
data[i]=data[j];
data[j]=temp;
}
cout<<"nSorted Array Is";
for(int i=0;i<n;i++)
cout<<"n"<<data[i];
cout<<endl;
return 0;
}
Bubble
int main()
{
int s,temp,i,j,a[20];
cout<<"Enter total numbers of
elements: ";
cin>>s;
cout<<"Enter elements: ";
for(i=0;i<s;i++)
cin>>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;
}
}
}
cout<<"After sorting: "<<endl;
for(i=0;i<s;i++)
cout<<a[i]<<endl;
return 0;
}
Merg
#include<iostream>
#include<conio.h>
using namespace
std;
void mergesort(int
*,int,int);
void merge(int
*,int,int,int);
int a[20],i,n,b[20];
main()
{
cout <<"n enter no
of elements";
cin >> n;
cout <<"enter the
elements";
for(i=0;i<n;i++)
cin >> a[i];
mergesort(a,0,n-1);
cout <<" numbers
after sort";
for(i=0;i<n;i++)
cout << a[i] << " ";
getch();
}
Stack
#include <iostream>
#define STACKSIZE 10
using namespace std;
int Top=-1;
int Stack[STACKSIZE];
void Push(int);
int Pop(void);
bool IsEmpty(void);
bool IsFull(void);
void Traverse(void);
int main( )
{ int item, choice;
while( 1 )
{
cout<< "nnnnn";
cout<< " ******* STACK OPERATIONS
********* nn";
cout<< " 1- Push item n 2- Pop Item n";
cout<< " 3- Traverse / Display Stack Items
n 4- Exit.";
cout<< " nnt Your choice ---> ";
cin>> choice;
switch(choice)
{ case 1: if(IsFull())
cout<< "n Stack Full/Overflown";
void mergesort(int
a[],int i,int j)
{
int mid;
if(i<j)
{
mid=(i+j)/2;
mergesort(a,i,mid);
mergesort(a,mid+1,j
);
merge(a,i,mid,j);
}
}
void merge(int a[],int
low,int mid ,int high)
{
int h,i,j,k;
h=low;
i=low;
j=mid+1;
while(h<=mid &&
j<=high)
{
if(a[h]<=a[j])
b[i]=a[h++];
else
else
{ cout<< "n Enter a number: ";
cin>>item;
Push(item); }
break;
case 2: if(IsEmpty())
cout<< "n Stack is empty) n";
else
{
item=Pop();
cout<< "n deleted from Stack =
"<<item<<endl;
}
break;
case 3: if(IsEmpty())
cout<< "n Stack is empty) n";
else
{
cout<< "n List of Item pushed on
Stack:n";
Traverse();
}
break;
case 4: exit(0);
default:
cout<< "nnt Invalid Choice: n";
b[i]=a[j++];
i++;
}
if( h > mid)
for(k=j;k<=high;k++)
b[i++]=a[k];
else
for(k=h;k<=mid;k++)
b[i++]=a[k];
cout <<"n";
for(k=low;k<=high;k
++)
{ a[k]=b[k];
cout << a[k] <<" ";
}
}
}
}
}
void Push(int item)
{
Stack[++Top] = item;
}
int Pop( )
{
return Stack[Top--];
}
bool IsEmpty( )
{ if(Top == -1 )
return true ;
else
return false;
}
bool IsFull( )
{ if(Top == STACKSIZE-1 )
return true;
else
return false;
}
void Traverse( )
{ int TopTemp = Top;
do
{
cout<< Stack[TopTemp--]<<endl;
}
while(TopTemp>= 0);
}
do
{
cout<< Stack[TopTemp--]<<endl;
}
while(TopTemp>= 0);
}

More Related Content

What's hot

Array using recursion
Array using recursionArray using recursion
Array using recursion
Swarup Boro
 
C++ practical
C++ practicalC++ practical
C++ practical
Rahul juneja
 
Ada file
Ada fileAda file
Ada file
Kumar Gaurav
 
Modificacion del programa
Modificacion del programaModificacion del programa
Modificacion del programa
Mario José
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
Aram SE
 
オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)
Takayuki Goto
 
C Programming :- An Example
C Programming :- An Example C Programming :- An Example
C Programming :- An Example
Atit Gaonkar
 
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 77 of 184
The Ring programming language version 1.5.3 book - Part 77 of 184The Ring programming language version 1.5.3 book - Part 77 of 184
The Ring programming language version 1.5.3 book - Part 77 of 184
Mahmoud Samir Fayed
 
Data structure programs in c++
Data structure programs in c++Data structure programs in c++
Data structure programs in c++
mmirfan
 
The Ring programming language version 1.5.1 book - Part 63 of 180
The Ring programming language version 1.5.1 book - Part 63 of 180The Ring programming language version 1.5.1 book - Part 63 of 180
The Ring programming language version 1.5.1 book - Part 63 of 180
Mahmoud Samir Fayed
 
Data structures cs301 power point slides lecture 03
Data structures   cs301 power point slides lecture 03Data structures   cs301 power point slides lecture 03
Data structures cs301 power point slides lecture 03
Nasir Mehmood
 
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
Mahmoud Samir Fayed
 
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий КуриловАсинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Yandex
 
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
Mahmoud Samir Fayed
 
OOP 2012 - Hint: Dynamic allocation in c++
OOP 2012 - Hint: Dynamic allocation in c++OOP 2012 - Hint: Dynamic allocation in c++
OOP 2012 - Hint: Dynamic allocation in c++
Allan Sun
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
Ankit Dixit
 
Brief intro to clojure
Brief intro to clojureBrief intro to clojure
Brief intro to clojure
Roy Rutto
 
The Ring programming language version 1.6 book - Part 69 of 189
The Ring programming language version 1.6 book - Part 69 of 189The Ring programming language version 1.6 book - Part 69 of 189
The Ring programming language version 1.6 book - Part 69 of 189
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 67 of 185
The Ring programming language version 1.5.4 book - Part 67 of 185The Ring programming language version 1.5.4 book - Part 67 of 185
The Ring programming language version 1.5.4 book - Part 67 of 185
Mahmoud Samir Fayed
 

What's hot (20)

Array using recursion
Array using recursionArray using recursion
Array using recursion
 
C++ practical
C++ practicalC++ practical
C++ practical
 
Ada file
Ada fileAda file
Ada file
 
Modificacion del programa
Modificacion del programaModificacion del programa
Modificacion del programa
 
1 borland c++ 5.02 by aramse
1   borland c++ 5.02 by aramse1   borland c++ 5.02 by aramse
1 borland c++ 5.02 by aramse
 
オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)
 
C Programming :- An Example
C Programming :- An Example C Programming :- An Example
C Programming :- An Example
 
The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30The Ring programming language version 1.4 book - Part 18 of 30
The Ring programming language version 1.4 book - Part 18 of 30
 
The Ring programming language version 1.5.3 book - Part 77 of 184
The Ring programming language version 1.5.3 book - Part 77 of 184The Ring programming language version 1.5.3 book - Part 77 of 184
The Ring programming language version 1.5.3 book - Part 77 of 184
 
Data structure programs in c++
Data structure programs in c++Data structure programs in c++
Data structure programs in c++
 
The Ring programming language version 1.5.1 book - Part 63 of 180
The Ring programming language version 1.5.1 book - Part 63 of 180The Ring programming language version 1.5.1 book - Part 63 of 180
The Ring programming language version 1.5.1 book - Part 63 of 180
 
Data structures cs301 power point slides lecture 03
Data structures   cs301 power point slides lecture 03Data structures   cs301 power point slides lecture 03
Data structures cs301 power point slides lecture 03
 
The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202The Ring programming language version 1.8 book - Part 75 of 202
The Ring programming language version 1.8 book - Part 75 of 202
 
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий КуриловАсинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
 
The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196The Ring programming language version 1.7 book - Part 73 of 196
The Ring programming language version 1.7 book - Part 73 of 196
 
OOP 2012 - Hint: Dynamic allocation in c++
OOP 2012 - Hint: Dynamic allocation in c++OOP 2012 - Hint: Dynamic allocation in c++
OOP 2012 - Hint: Dynamic allocation in c++
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
 
Brief intro to clojure
Brief intro to clojureBrief intro to clojure
Brief intro to clojure
 
The Ring programming language version 1.6 book - Part 69 of 189
The Ring programming language version 1.6 book - Part 69 of 189The Ring programming language version 1.6 book - Part 69 of 189
The Ring programming language version 1.6 book - Part 69 of 189
 
The Ring programming language version 1.5.4 book - Part 67 of 185
The Ring programming language version 1.5.4 book - Part 67 of 185The Ring programming language version 1.5.4 book - Part 67 of 185
The Ring programming language version 1.5.4 book - Part 67 of 185
 

Viewers also liked

INSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVA
INSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVAINSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVA
INSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVA
Alvaro Bolivar Huera Obando
 
Partes internas del PC
Partes internas del PCPartes internas del PC
Partes internas del PC
20LoreCapera
 
Components of OD by Priyanka & Shephali
Components of OD  by Priyanka & ShephaliComponents of OD  by Priyanka & Shephali
Components of OD by Priyanka & Shephali
Priyanka Sharma
 
Partes internas y externas del PC
Partes internas y externas del PCPartes internas y externas del PC
Partes internas y externas del PC
20LoreCapera
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
maamir farooq
 
Stack
StackStack
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
maamir farooq
 
Register introduction
Register introductionRegister introduction
Register introduction
maamir farooq
 
Merge sort lab mannual
Merge sort lab mannualMerge sort lab mannual
Merge sort lab mannual
maamir farooq
 
Segment registers
Segment registersSegment registers
Segment registers
maamir farooq
 
Queues
QueuesQueues
ملٹی لیول کے شے۔
ملٹی لیول کے شے۔ملٹی لیول کے شے۔
ملٹی لیول کے شے۔
maamir farooq
 
Cacheorginization
Cacheorginization Cacheorginization
Cacheorginization
maamir farooq
 
Statistics
Statistics Statistics
Statistics
maamir farooq
 
Register organisation
Register organisationRegister organisation
Register organisation
maamir farooq
 
Memory segmentations
Memory  segmentations Memory  segmentations
Memory segmentations
maamir farooq
 
Cache memory
Cache memoryCache memory
Cache memory
maamir farooq
 
Array data structure
Array data structureArray data structure
Array data structure
maamir farooq
 

Viewers also liked (18)

INSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVA
INSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVAINSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVA
INSTITUTO TECNOLOGICO SUPERIOR VIDA NUEVA
 
Partes internas del PC
Partes internas del PCPartes internas del PC
Partes internas del PC
 
Components of OD by Priyanka & Shephali
Components of OD  by Priyanka & ShephaliComponents of OD  by Priyanka & Shephali
Components of OD by Priyanka & Shephali
 
Partes internas y externas del PC
Partes internas y externas del PCPartes internas y externas del PC
Partes internas y externas del PC
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
Stack
StackStack
Stack
 
Data structures stacks
Data structures   stacksData structures   stacks
Data structures stacks
 
Register introduction
Register introductionRegister introduction
Register introduction
 
Merge sort lab mannual
Merge sort lab mannualMerge sort lab mannual
Merge sort lab mannual
 
Segment registers
Segment registersSegment registers
Segment registers
 
Queues
QueuesQueues
Queues
 
ملٹی لیول کے شے۔
ملٹی لیول کے شے۔ملٹی لیول کے شے۔
ملٹی لیول کے شے۔
 
Cacheorginization
Cacheorginization Cacheorginization
Cacheorginization
 
Statistics
Statistics Statistics
Statistics
 
Register organisation
Register organisationRegister organisation
Register organisation
 
Memory segmentations
Memory  segmentations Memory  segmentations
Memory segmentations
 
Cache memory
Cache memoryCache memory
Cache memory
 
Array data structure
Array data structureArray data structure
Array data structure
 

Similar to Sortings

Sorting programs
Sorting programsSorting programs
Sorting programs
Varun Garg
 
COA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfCOA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdf
JavedAnsari236392
 
Ds program-print
Ds program-printDs program-print
Ds program-print
Chaitanya Kn
 
Abebe1
Abebe1Abebe1
Abebe1
abemekie
 
Ds 2 cycle
Ds 2 cycleDs 2 cycle
Ds 2 cycle
Chaitanya Kn
 
Microsoft Word Hw#1
Microsoft Word   Hw#1Microsoft Word   Hw#1
Microsoft Word Hw#1
kkkseld
 
Questions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfQuestions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdf
apexelectronices01
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
Vishvjeet Yadav
 
Code
CodeCode
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
shreeaadithyaacellso
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)
Ankit Gupta
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
Rahul Chugh
 
project3
project3project3
project3
Russell Rawls
 
C programs
C programsC programs
C programs
Koshy Geoji
 
Problem Solving using codes Strings-Extra.pptx
Problem Solving using codes Strings-Extra.pptxProblem Solving using codes Strings-Extra.pptx
Problem Solving using codes Strings-Extra.pptx
happycocoman
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 
Aa
AaAa
Matlab assignment
Matlab assignmentMatlab assignment
Matlab assignment
Rutvik
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
HIMANSUKUMAR12
 
C programs
C programsC programs

Similar to Sortings (20)

Sorting programs
Sorting programsSorting programs
Sorting programs
 
COA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfCOA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdf
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
Abebe1
Abebe1Abebe1
Abebe1
 
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
 
Questions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdfQuestions has 4 parts.1st part Program to implement sorting algor.pdf
Questions has 4 parts.1st part Program to implement sorting algor.pdf
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
 
Code
CodeCode
Code
 
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
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
project3
project3project3
project3
 
C programs
C programsC programs
C programs
 
Problem Solving using codes Strings-Extra.pptx
Problem Solving using codes Strings-Extra.pptxProblem Solving using codes Strings-Extra.pptx
Problem Solving using codes Strings-Extra.pptx
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
Aa
AaAa
Aa
 
Matlab assignment
Matlab assignmentMatlab assignment
Matlab assignment
 
Computer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdfComputer_Practicals-file.doc.pdf
Computer_Practicals-file.doc.pdf
 
C programs
C programsC programs
C programs
 

More from maamir farooq

Ooad lab1
Ooad lab1Ooad lab1
Ooad lab1
maamir farooq
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
maamir farooq
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
maamir farooq
 
Php client libray
Php client librayPhp client libray
Php client libray
maamir farooq
 
Swiftmailer
SwiftmailerSwiftmailer
Swiftmailer
maamir farooq
 
Lect15
Lect15Lect15
Lec 7
Lec 7Lec 7
Lec 6
Lec 6Lec 6
Lec 5
Lec 5Lec 5
J query 1.7 cheat sheet
J query 1.7 cheat sheetJ query 1.7 cheat sheet
J query 1.7 cheat sheet
maamir farooq
 
Assignment
AssignmentAssignment
Assignment
maamir farooq
 
Java script summary
Java script summaryJava script summary
Java script summary
maamir farooq
 
Lec 3
Lec 3Lec 3
Lec 2
Lec 2Lec 2
Lec 1
Lec 1Lec 1
Css summary
Css summaryCss summary
Css summary
maamir farooq
 
Manual of image processing lab
Manual of image processing labManual of image processing lab
Manual of image processing lab
maamir farooq
 
Session management
Session managementSession management
Session management
maamir farooq
 
Data management
Data managementData management
Data management
maamir farooq
 
Content provider
Content providerContent provider
Content provider
maamir farooq
 

More from maamir farooq (20)

Ooad lab1
Ooad lab1Ooad lab1
Ooad lab1
 
Lesson 03
Lesson 03Lesson 03
Lesson 03
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 
Php client libray
Php client librayPhp client libray
Php client libray
 
Swiftmailer
SwiftmailerSwiftmailer
Swiftmailer
 
Lect15
Lect15Lect15
Lect15
 
Lec 7
Lec 7Lec 7
Lec 7
 
Lec 6
Lec 6Lec 6
Lec 6
 
Lec 5
Lec 5Lec 5
Lec 5
 
J query 1.7 cheat sheet
J query 1.7 cheat sheetJ query 1.7 cheat sheet
J query 1.7 cheat sheet
 
Assignment
AssignmentAssignment
Assignment
 
Java script summary
Java script summaryJava script summary
Java script summary
 
Lec 3
Lec 3Lec 3
Lec 3
 
Lec 2
Lec 2Lec 2
Lec 2
 
Lec 1
Lec 1Lec 1
Lec 1
 
Css summary
Css summaryCss summary
Css summary
 
Manual of image processing lab
Manual of image processing labManual of image processing lab
Manual of image processing lab
 
Session management
Session managementSession management
Session management
 
Data management
Data managementData management
Data management
 
Content provider
Content providerContent provider
Content provider
 

Recently uploaded

A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
Celine George
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
TechSoup
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 

Recently uploaded (20)

A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 

Sortings

  • 1. Insertin int main() { int a[16],i,j,k,temp,n; cout<<"enter number of elements "; cin>>n; cout<<"enter the elementsn"; for(i=0;i<n;i++) { cin>>a[i]; } for(i=1;i<n;i++) { for(j=i;j>=1;j--) { if(a[j]<a[j-1]) { temp=a[j]; a[j]=a[j-1]; a[j-1]=temp; } else break; } } cout<<"sorted arrayn"<<endl; for(k=0;k<n;k++) { cout<<a[k]<<endl; } return 0; } Selection int main() { int data[10],temp,i,n; cout<<"Enter number of elementsn"; cin>>n; cout<<"Enter integersn"; for (i = 0; i < n; i++) cin>>data[i]; for(int i=0;i<n-1;i++) for(int j=i+1;j<n;j++) if(data[i]<data[j]) { temp=data[i]; data[i]=data[j]; data[j]=temp; } cout<<"nSorted Array Is"; for(int i=0;i<n;i++) cout<<"n"<<data[i]; cout<<endl; return 0; } Bubble int main() { int s,temp,i,j,a[20]; cout<<"Enter total numbers of elements: "; cin>>s; cout<<"Enter elements: "; for(i=0;i<s;i++) cin>>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; } } } cout<<"After sorting: "<<endl; for(i=0;i<s;i++) cout<<a[i]<<endl; return 0; }
  • 2. Merg #include<iostream> #include<conio.h> using namespace std; void mergesort(int *,int,int); void merge(int *,int,int,int); int a[20],i,n,b[20]; main() { cout <<"n enter no of elements"; cin >> n; cout <<"enter the elements"; for(i=0;i<n;i++) cin >> a[i]; mergesort(a,0,n-1); cout <<" numbers after sort"; for(i=0;i<n;i++) cout << a[i] << " "; getch(); } Stack #include <iostream> #define STACKSIZE 10 using namespace std; int Top=-1; int Stack[STACKSIZE]; void Push(int); int Pop(void); bool IsEmpty(void); bool IsFull(void); void Traverse(void); int main( ) { int item, choice; while( 1 ) { cout<< "nnnnn"; cout<< " ******* STACK OPERATIONS ********* nn"; cout<< " 1- Push item n 2- Pop Item n"; cout<< " 3- Traverse / Display Stack Items n 4- Exit."; cout<< " nnt Your choice ---> "; cin>> choice; switch(choice) { case 1: if(IsFull()) cout<< "n Stack Full/Overflown";
  • 3. void mergesort(int a[],int i,int j) { int mid; if(i<j) { mid=(i+j)/2; mergesort(a,i,mid); mergesort(a,mid+1,j ); merge(a,i,mid,j); } } void merge(int a[],int low,int mid ,int high) { int h,i,j,k; h=low; i=low; j=mid+1; while(h<=mid && j<=high) { if(a[h]<=a[j]) b[i]=a[h++]; else else { cout<< "n Enter a number: "; cin>>item; Push(item); } break; case 2: if(IsEmpty()) cout<< "n Stack is empty) n"; else { item=Pop(); cout<< "n deleted from Stack = "<<item<<endl; } break; case 3: if(IsEmpty()) cout<< "n Stack is empty) n"; else { cout<< "n List of Item pushed on Stack:n"; Traverse(); } break; case 4: exit(0); default: cout<< "nnt Invalid Choice: n";
  • 4. b[i]=a[j++]; i++; } if( h > mid) for(k=j;k<=high;k++) b[i++]=a[k]; else for(k=h;k<=mid;k++) b[i++]=a[k]; cout <<"n"; for(k=low;k<=high;k ++) { a[k]=b[k]; cout << a[k] <<" "; } } } } } void Push(int item) { Stack[++Top] = item; } int Pop( ) { return Stack[Top--]; } bool IsEmpty( ) { if(Top == -1 ) return true ; else return false; } bool IsFull( ) { if(Top == STACKSIZE-1 ) return true; else return false; } void Traverse( ) { int TopTemp = Top;