SlideShare a Scribd company logo
PRESENTATION
On
Bubble sorting
Submitted to-
Ms. Apurva Gautam
Dept. of Computer Science
Submitted By-
Ayush Pandey
B.C.A. II sem.
WELCOME
Contents
● Introduction to Sorting
● Introduction to Bubble Sort
● Example of Bubble Sort
● Algorithm of Bubble sort
● Program of Bubble sort
Introduction
Sorting- Sorting takes an unordered
collection and makes it an ordered one.
1 2 3 4 5
1 2 3 4 5
5 7 2 1 4
1 2 4 5 7
Introduction
Bubble sort- The Algorithm is Bubble Sort
involves two steps over and over until the
data sorted.
1 Compare Adjacent two element if
necessary swap them.
Algorithm of Bubble Sort
1.Initialisation
Set I=0
2. repeat step 3 to 5 until I<M
3. J=0
4.repeat step 5 until J < N – I -1
5. If A[J] > A[J+1] then
step temp=A[J]
Set A[J]=A[J+1]
set A[J+1]= temp
end if
6. exit
Example
5 7 2 1 4
5 2 7 1 4
1 2 3 4 5
5 2 1 7 45 2 1 7 4
5 2 1 4 7
2
2 5 1 4 72
2 1 5 4 7
Example
● 3
2 5 4 71
1 2 4 5 7
Program of Bubble Sort
#include<stdio.h>
#include<conio.h>
void main()
{int arr[20],i,j,k,n;
printf(“Enter the size of array”);
scanf(“%d”,&n);
printf(“Enter the element of array”);
for(i=0;i<n;i++)
{scanf(“%d”,&arr[i]):
}
for(i=0;I<n;ioi++)
{for(j=i+1;j<n;j++)
{if(arr[i]>arr[j])
●
{
arr[i]=k;
arr[i]=arr[j];
arr[j]=k;
}}}
printf(“New array is”);
●
Print
●
getch();
●
}
THANK YOU

More Related Content

What's hot

Concurrent force system
Concurrent force systemConcurrent force system
Concurrent force system
Vinod Shikhare
 
201707 CSE110 Lecture 29
201707 CSE110 Lecture 29201707 CSE110 Lecture 29
201707 CSE110 Lecture 29
Javier Gonzalez-Sanchez
 
Integration by parts
Integration by partsIntegration by parts
Integration by partsjaflint718
 
Approximation Algorithms Part Two: More Constant factor approximations
Approximation Algorithms Part Two: More Constant factor approximationsApproximation Algorithms Part Two: More Constant factor approximations
Approximation Algorithms Part Two: More Constant factor approximations
Benjamin Sach
 
Presentation_Parallel GRASP algorithm for job shop scheduling
Presentation_Parallel GRASP algorithm for job shop schedulingPresentation_Parallel GRASP algorithm for job shop scheduling
Presentation_Parallel GRASP algorithm for job shop schedulingAntonio Maria Fiscarelli
 
Determininstic rounding of linear programs
Determininstic rounding of linear programsDetermininstic rounding of linear programs
Determininstic rounding of linear programs
shibbirtanvin
 
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration | Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
FabMinds
 

What's hot (9)

Concurrent force system
Concurrent force systemConcurrent force system
Concurrent force system
 
201707 CSE110 Lecture 29
201707 CSE110 Lecture 29201707 CSE110 Lecture 29
201707 CSE110 Lecture 29
 
Integration by parts
Integration by partsIntegration by parts
Integration by parts
 
Factor Label
Factor LabelFactor Label
Factor Label
 
Approximation Algorithms Part Two: More Constant factor approximations
Approximation Algorithms Part Two: More Constant factor approximationsApproximation Algorithms Part Two: More Constant factor approximations
Approximation Algorithms Part Two: More Constant factor approximations
 
Presentation_Parallel GRASP algorithm for job shop scheduling
Presentation_Parallel GRASP algorithm for job shop schedulingPresentation_Parallel GRASP algorithm for job shop scheduling
Presentation_Parallel GRASP algorithm for job shop scheduling
 
algorithms
algorithmsalgorithms
algorithms
 
Determininstic rounding of linear programs
Determininstic rounding of linear programsDetermininstic rounding of linear programs
Determininstic rounding of linear programs
 
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration | Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
 

Recently uploaded

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
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
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
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
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
 
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
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
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
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 

Recently uploaded (20)

Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
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
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
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
 
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
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
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
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 

Bubble sort

  • 1. PRESENTATION On Bubble sorting Submitted to- Ms. Apurva Gautam Dept. of Computer Science Submitted By- Ayush Pandey B.C.A. II sem.
  • 3. Contents ● Introduction to Sorting ● Introduction to Bubble Sort ● Example of Bubble Sort ● Algorithm of Bubble sort ● Program of Bubble sort
  • 4. Introduction Sorting- Sorting takes an unordered collection and makes it an ordered one. 1 2 3 4 5 1 2 3 4 5 5 7 2 1 4 1 2 4 5 7
  • 5. Introduction Bubble sort- The Algorithm is Bubble Sort involves two steps over and over until the data sorted. 1 Compare Adjacent two element if necessary swap them.
  • 6. Algorithm of Bubble Sort 1.Initialisation Set I=0 2. repeat step 3 to 5 until I<M 3. J=0 4.repeat step 5 until J < N – I -1 5. If A[J] > A[J+1] then step temp=A[J]
  • 7. Set A[J]=A[J+1] set A[J+1]= temp end if 6. exit
  • 8. Example 5 7 2 1 4 5 2 7 1 4 1 2 3 4 5
  • 9. 5 2 1 7 45 2 1 7 4 5 2 1 4 7
  • 10. 2 2 5 1 4 72 2 1 5 4 7
  • 11. Example ● 3 2 5 4 71 1 2 4 5 7
  • 12. Program of Bubble Sort #include<stdio.h> #include<conio.h> void main() {int arr[20],i,j,k,n; printf(“Enter the size of array”); scanf(“%d”,&n); printf(“Enter the element of array”); for(i=0;i<n;i++) {scanf(“%d”,&arr[i]): } for(i=0;I<n;ioi++) {for(j=i+1;j<n;j++) {if(arr[i]>arr[j]) ● { arr[i]=k; arr[i]=arr[j]; arr[j]=k; }}} printf(“New array is”); ● Print ● getch(); ● }