SlideShare a Scribd company logo
• A Presentation topic for c++ topic
• A Good style and appreciated
Sorting
 Sorting takes an unordered collection and
makes it an ordered one.
512354277 101
1 2 3 4 5 6
5 12 35 42 77 101
1 2 3 4 5 6
Introduction: Bubble Sort
Also called Exchange sort.
It repeatedly visits the array and compares two items at a
time. It swaps these two items if they are in the wrong order.
It continues to visit the array until no swaps are needed that
means the array is sorted.
Bubble sort a best presentation topic
Bubble sort a best presentation topic
Bubble sort a best presentation topic
Bubble sort a best presentation topic
674523 14 6 3398 42
The First “Bubble Up”
674523 14 6 3398 42
The First “Bubble Up”
674523 14 6 3398 42
Swap
The First “Bubble Up”
674598 14 6 3323 42
Swap
The First “Bubble Up”
674598 14 6 3323 42
The First “Bubble Up”
674598 14 6 3323 42
Swap
The First “Bubble Up”
679845 14 6 3323 42
Swap
The First “Bubble Up”
679845 14 6 3323 42
The First “Bubble Up”
679845 14 6 3323 42
Swap
The First “Bubble Up”
671445 98 6 3323 42
Swap
The First “Bubble Up”
671445 98 6 3323 42
The First “Bubble Up”
671445 98 6 3323 42
Swap
The First “Bubble Up”
671445 6 98 3323 42
Swap
The First “Bubble Up”
671445 6 98 3323 42
The First “Bubble Up”
671445 6 98 3323 42
Swap
The First “Bubble Up”
981445 6 67 3323 42
Swap
The First “Bubble Up”
981445 6 67 3323 42
The First “Bubble Up”
981445 6 67 3323 42
Swap
The First “Bubble Up”
331445 6 67 9823 42
Swap
The First “Bubble Up”
331445 6 67 9823 42
The First “Bubble Up”
331445 6 67 9823 42
Swap
The First “Bubble Up”
331445 6 67 4223 98
Swap
The First “Bubble Up”
331445 6 67 4223 98
Finished first “Bubble Up”
The First “Bubble Up”
The Second “Bubble Up”
331445 6 67 4223 98
The Second “Bubble Up”
331445 6 67 4223 98
No Swap
The Second “Bubble Up”
331445 6 67 4223 98
The Second “Bubble Up”
331445 6 67 4223 98
Swap
The Second “Bubble Up”
334514 6 67 4223 98
Swap
The Second “Bubble Up”
334514 6 67 4223 98
The Second “Bubble Up”
334514 6 67 4223 98
Swap
The Second “Bubble Up”
33614 45 67 4223 98
Swap
The Second “Bubble Up”
33614 45 67 4223 98
The Second “Bubble Up”
33614 45 67 4223 98
No Swap
The Second “Bubble Up”
33614 45 67 4223 98
The Second “Bubble Up”
33614 45 67 4223 98
Swap
The Second “Bubble Up”
67614 45 33 4223 98
Swap
The Second “Bubble Up”
67614 45 33 4223 98
The Second “Bubble Up”
67614 45 33 4223 98
Swap
The Second “Bubble Up”
42614 45 33 6723 98
Swap
42614 45 33 6723 98
Finished second “Bubble Up”
The Second “Bubble Up”
The Third “Bubble Up”
42614 45 33 6723 98
The Third “Bubble Up”
42614 45 33 6723 98
Swap
The Third “Bubble Up”
42623 45 33 6714 98
Swap
The Third “Bubble Up”
42623 45 33 6714 98
The Third “Bubble Up”
42623 45 33 6714 98
Swap
The Third “Bubble Up”
42236 45 33 6714 98
Swap
The Third “Bubble Up”
42236 45 33 6714 98
The Third “Bubble Up”
42236 45 33 6714 98
No Swap
The Third “Bubble Up”
42236 45 33 6714 98
The Third “Bubble Up”
42236 45 33 6714 98
Swap
The Third “Bubble Up”
42236 33 45 6714 98
Swap
The Third “Bubble Up”
42236 33 45 6714 98
The Third “Bubble Up”
42236 33 45 6714 98
Swap
The Third “Bubble Up”
45236 33 42 6714 98
Swap
After Third Pass of Outer Loop
45236 33 42 6714 98
Finished third “Bubble Up”
The Fourth “Bubble Up”
45236 33 42 6714 98
The Fourth “Bubble Up”
45236 33 42 6714 98
Swap
The Fourth “Bubble Up”
452314 33 42 676 98
Swap
The Fourth “Bubble Up”
452314 33 42 676 98
The Fourth “Bubble Up”
452314 33 42 676 98
No Swap
The Fourth “Bubble Up”
452314 33 42 676 98
The Fourth “Bubble Up”
452314 33 42 676 98
No Swap
The Fourth “Bubble Up”
452314 33 42 676 98
The Fourth “Bubble Up”
452314 33 42 676 98
No Swap
452314 33 42 676 98
Finished fourth “Bubble Up”
After Fourth Pass of Outer Loop
The Fifth “Bubble Up”
452314 33 42 676 98
The Fifth “Bubble Up”
452314 33 42 676 98
No Swap
The Fifth “Bubble Up”
452314 33 42 676 98
The Fifth “Bubble Up”
452314 33 42 676 98
No Swap
The Fifth “Bubble Up”
452314 33 42 676 98
The Fifth “Bubble Up”
452314 33 42 676 98
No Swap
After Fifth Pass of Outer Loop
452314 33 42 676 98
Finished fifth “Bubble Up”
452314 33 42 676 98
We did not do any swapping,
so all of the other elements
must be correctly placed.
We can “skip” the last two
passes of the outer loop.
Program
void main()
{
int arr[5],i,j,tem;
cout<<“Enter Five Values”;
for(i=0,i<5,i++)
cin>>arr[i];
cout<<“The origanal values in array:n”;
for(i=0;i<5;i++)
cout<<arr[i]<<“ “;
for(i=0;i<5;i++)
for(j=0;j<4;j++)
If(arr[ j ]>arr[ j+1 ]
{
tem=arr[ j ];
arr[ j ]=arr[ j+1 ];
arr[ j+1]=tem;
}
cout<<“n The sorted array: n”;
for(i=0;i<5;i++)
cout<<arr[ i ]<<“ “;
getch();
}

More Related Content

PDF
Bubblesort Algorithm
PPT
PPTX
Different Sorting tecniques in Data Structure
PPTX
Doubly Linked List || Operations || Algorithms
PPTX
Vi editor
PPTX
Bubble sort
PPT
Quick Sort
PDF
Applications of stack
Bubblesort Algorithm
Different Sorting tecniques in Data Structure
Doubly Linked List || Operations || Algorithms
Vi editor
Bubble sort
Quick Sort
Applications of stack

What's hot (20)

PPTX
Data Structures - Lecture 7 [Linked List]
PPTX
Ppt bubble sort
PPT
Bubble sort
PPTX
Merge sort algorithm
PPTX
Adjacency list
PDF
Algorithms Lecture 4: Sorting Algorithms I
PPTX
Radix sort presentation
PPT
Searching algorithms
PPT
stack and queue array implementation in java.
PPT
Algorithm: Quick-Sort
PPT
Data Structures with C Linked List
PPT
1.5 binary search tree
PPS
Single linked list
PPTX
Merge sort
PPTX
Queues in C++
PPT
SEARCHING AND SORTING ALGORITHMS
PPT
Data structures & algorithms lecture 3
PPT
String matching algorithm
PPTX
Doubly linked list (animated)
PPT
Merge sort
Data Structures - Lecture 7 [Linked List]
Ppt bubble sort
Bubble sort
Merge sort algorithm
Adjacency list
Algorithms Lecture 4: Sorting Algorithms I
Radix sort presentation
Searching algorithms
stack and queue array implementation in java.
Algorithm: Quick-Sort
Data Structures with C Linked List
1.5 binary search tree
Single linked list
Merge sort
Queues in C++
SEARCHING AND SORTING ALGORITHMS
Data structures & algorithms lecture 3
String matching algorithm
Doubly linked list (animated)
Merge sort
Ad

Viewers also liked (20)

PPTX
Bubble Sort
PPT
Bubble sort
PPTX
Bubble sort algorithm
PPT
3.1 bubble sort
PPTX
Selection sort
PPT
Sorting
PPT
Sorting Algorithms
PPTX
Selection sort
PPT
Data Structures - Searching & sorting
PDF
PDF
Bubble sort
PDF
Working of Merge Sort Code
ODP
Python Day1
PPT
Data Structure Sorting
PPTX
Sorting
PPT
PDF
sort search in C
PDF
Operating Systems - Intro to C++
PPT
Linear and Bianry search
PPS
Algorithms
Bubble Sort
Bubble sort
Bubble sort algorithm
3.1 bubble sort
Selection sort
Sorting
Sorting Algorithms
Selection sort
Data Structures - Searching & sorting
Bubble sort
Working of Merge Sort Code
Python Day1
Data Structure Sorting
Sorting
sort search in C
Operating Systems - Intro to C++
Linear and Bianry search
Algorithms
Ad

Similar to Bubble sort a best presentation topic (12)

PPT
Bubble_sort week Bubble_sort week Bubble_sort week
PPT
Bubble sort
PPT
Sorting of arrays, types in c++ .IST .ppt
PPT
Bubble sort
PPT
sortingofarrays-240425134605-b7961d41.ppt
PDF
Sorting bubble-sort anim
PPTX
Sorting techniques Anil Dutt
PPT
Bubble sort/ Exchange sort Algorithmdata structures and algorithms-2018,bs it...
PPT
Bubble Sort Python
PPT
cs1311lecture16wdl.ppt
PPT
Bubble Sort.ppt
PPT
sorting techniques PPT.ppt
Bubble_sort week Bubble_sort week Bubble_sort week
Bubble sort
Sorting of arrays, types in c++ .IST .ppt
Bubble sort
sortingofarrays-240425134605-b7961d41.ppt
Sorting bubble-sort anim
Sorting techniques Anil Dutt
Bubble sort/ Exchange sort Algorithmdata structures and algorithms-2018,bs it...
Bubble Sort Python
cs1311lecture16wdl.ppt
Bubble Sort.ppt
sorting techniques PPT.ppt

Recently uploaded (20)

PPTX
Cell Types and Its function , kingdom of life
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Classroom Observation Tools for Teachers
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
GDM (1) (1).pptx small presentation for students
Cell Types and Its function , kingdom of life
Chinmaya Tiranga quiz Grand Finale.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
human mycosis Human fungal infections are called human mycosis..pptx
Microbial diseases, their pathogenesis and prophylaxis
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Orientation - ARALprogram of Deped to the Parents.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
2.FourierTransform-ShortQuestionswithAnswers.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
VCE English Exam - Section C Student Revision Booklet
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Classroom Observation Tools for Teachers
Abdominal Access Techniques with Prof. Dr. R K Mishra
O5-L3 Freight Transport Ops (International) V1.pdf
GDM (1) (1).pptx small presentation for students

Bubble sort a best presentation topic