SlideShare a Scribd company logo
2
Most read
3
Most read
7
Most read
SUBMITTED BY :
Name : Saiful Islam
Institute: Green University Of Bd
ID : 162-015-022
Batch : 162
1
What is bubble sort :
Bubble short is A simple sorting algorithm. This sorting algorithm is
comparison based algorithm in which each pair of adjacent elements is
compared and elements are swapped if they are not in order . this
algorithm is not suitable for large data sets as its average and worst case
complexity are of 0(n2) where n are no. Of items.
2
How bubble sort works?
We take an unsorted array for our example. Bubble sort take 0(n2) time so
we’re keeping short and precise.
3
Sorting :
 In this case, value 33 is greater than 14, so it is already in sorted locations.
Next, we compare 33 with 27
 Bubble sort starts with very first two elements, comparing them to check
which one is greater.
4
Sorting :
 The new array should look like this -
 We find that 27 is smaller than 33 and these two values must be swapped.
5
Sorting :
 Next we compare 33 and 35. We find that both are in already sorted
position.
 Then we move to next two values, 35 and 10.
 We know than 10 is smaller 35. Hence they are not sorted.
6
Sorting second time :
First sort
Second sort
Third sort
Fourth sort
Now we should look into same practical aspects of bubble sort.
7
Advantages :
 It does not deal well with a list containing a huge number of
items.
 More than the number of comparisons.
 The code become complex for large amount of data.
Disadvantages :
 Bubble sort is one of the easiest sort algorithm.
 It is easy to implement.
 Elements are swapped in place, not use extra array.
 It is stable and fast.
8
9

More Related Content

PPT
Bubble sort
Manek Ar
 
PPTX
Sorting Algorithms
Pranay Neema
 
PPTX
Ppt bubble sort
prabhakar jalasutram
 
PPTX
Bubble sort
Rashmi R Upadhya
 
PPTX
Bubble Sort Algorithm Presentation
AhmedAlbutty
 
PPTX
Selection sorting
Himanshu Kesharwani
 
PPTX
Presentation on the topic selection sort
District Administration
 
PDF
Sorting Algorithms
Mohammed Hussein
 
Bubble sort
Manek Ar
 
Sorting Algorithms
Pranay Neema
 
Ppt bubble sort
prabhakar jalasutram
 
Bubble sort
Rashmi R Upadhya
 
Bubble Sort Algorithm Presentation
AhmedAlbutty
 
Selection sorting
Himanshu Kesharwani
 
Presentation on the topic selection sort
District Administration
 
Sorting Algorithms
Mohammed Hussein
 

What's hot (20)

PPT
Binary Search
kunj desai
 
PPTX
Linear search-and-binary-search
International Islamic University
 
PPTX
Quick sort-Data Structure
Jeanie Arnoco
 
PPTX
Sorting
Ashim Lamichhane
 
PPTX
Linear Search Presentation
Markajul Hasnain Alif
 
PPTX
Tree - Data Structure
Ashim Lamichhane
 
PPT
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
PPTX
trees in data structure
shameen khan
 
PPTX
Merge sort algorithm
Shubham Dwivedi
 
PPTX
Insertion Sorting
FarihaHabib123
 
PPTX
Insertion sort
almaqboli
 
PPTX
Hashing
Amar Jukuntla
 
PDF
Algorithms Lecture 4: Sorting Algorithms I
Mohamed Loey
 
PPTX
Linear Search Data Structure
Talha Shaikh
 
PDF
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
 
PDF
Linear search algorithm
NeoClassical
 
PPTX
Searching, Sorting and Hashing Techniques
Selvaraj Seerangan
 
PPTX
Data Structures : hashing (1)
Home
 
PPTX
Graph in data structure
Abrish06
 
Binary Search
kunj desai
 
Linear search-and-binary-search
International Islamic University
 
Quick sort-Data Structure
Jeanie Arnoco
 
Linear Search Presentation
Markajul Hasnain Alif
 
Tree - Data Structure
Ashim Lamichhane
 
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
trees in data structure
shameen khan
 
Merge sort algorithm
Shubham Dwivedi
 
Insertion Sorting
FarihaHabib123
 
Insertion sort
almaqboli
 
Hashing
Amar Jukuntla
 
Algorithms Lecture 4: Sorting Algorithms I
Mohamed Loey
 
Linear Search Data Structure
Talha Shaikh
 
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
 
Linear search algorithm
NeoClassical
 
Searching, Sorting and Hashing Techniques
Selvaraj Seerangan
 
Data Structures : hashing (1)
Home
 
Graph in data structure
Abrish06
 
Ad

Similar to Bubble sort | Data structure | (20)

PDF
Sorting arrays
Samar Anter
 
PPTX
Unit vii sorting
Tribhuvan University
 
PPTX
Sorting method data structure
sunilchute1
 
PPTX
SORTING techniques.pptx
Dr.Shweta
 
PPTX
Bubble sort
SujataRao11
 
PPTX
Data structure.pptx
SajalFayyaz
 
PDF
L 14-ct1120
Zia Ush Shamszaman
 
PPTX
Unit 7 sorting
Dabbal Singh Mahara
 
PPTX
Searching and sorting Techniques in Data structures
PRIANKA R
 
PPT
Sorting algorithums > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
PPT
Sorting algorithm
Muhammad Farhan
 
PPTX
Computer sciencebubble sorting algorithm
hebahosny20060467
 
PPT
ds 3Sorting.ppt
AlliVinay1
 
PPTX
Sorting-Algorithms-A-Comprehensive-Guide.pptx
ReemEmad26
 
PPTX
BUBBLESORT
Ashish Sadavarti
 
PPT
Sorting algorithms
CHANDAN KUMAR
 
DOCX
Sorting
BHARATH KUMAR
 
DOCX
Bubble sorting lab manual
maamir farooq
 
PDF
Sorting
Kariman Karm Gabaa
 
Sorting arrays
Samar Anter
 
Unit vii sorting
Tribhuvan University
 
Sorting method data structure
sunilchute1
 
SORTING techniques.pptx
Dr.Shweta
 
Bubble sort
SujataRao11
 
Data structure.pptx
SajalFayyaz
 
L 14-ct1120
Zia Ush Shamszaman
 
Unit 7 sorting
Dabbal Singh Mahara
 
Searching and sorting Techniques in Data structures
PRIANKA R
 
Sorting algorithums > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
Sorting algorithm
Muhammad Farhan
 
Computer sciencebubble sorting algorithm
hebahosny20060467
 
ds 3Sorting.ppt
AlliVinay1
 
Sorting-Algorithms-A-Comprehensive-Guide.pptx
ReemEmad26
 
BUBBLESORT
Ashish Sadavarti
 
Sorting algorithms
CHANDAN KUMAR
 
Sorting
BHARATH KUMAR
 
Bubble sorting lab manual
maamir farooq
 
Ad

Recently uploaded (20)

PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PDF
Principles of Food Science and Nutritions
Dr. Yogesh Kumar Kosariya
 
PPTX
EE3303-EM-I 25.7.25 electrical machines.pptx
Nagen87
 
PPTX
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
PDF
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Hyogeun Oh
 
PDF
Software Testing Tools - names and explanation
shruti533256
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PDF
Activated Carbon for Water and Wastewater Treatment_ Integration of Adsorptio...
EmilianoRodriguezTll
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PDF
flutter Launcher Icons, Splash Screens & Fonts
Ahmed Mohamed
 
PDF
Queuing formulas to evaluate throughputs and servers
gptshubham
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PPTX
unit 3a.pptx material management. Chapter of operational management
atisht0104
 
PPTX
AgentX UiPath Community Webinar series - Delhi
RohitRadhakrishnan8
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
PDF
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
PPTX
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
Principles of Food Science and Nutritions
Dr. Yogesh Kumar Kosariya
 
EE3303-EM-I 25.7.25 electrical machines.pptx
Nagen87
 
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
오픈소스 LLM, vLLM으로 Production까지 (Instruct.KR Summer Meetup, 2025)
Hyogeun Oh
 
Software Testing Tools - names and explanation
shruti533256
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Activated Carbon for Water and Wastewater Treatment_ Integration of Adsorptio...
EmilianoRodriguezTll
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
flutter Launcher Icons, Splash Screens & Fonts
Ahmed Mohamed
 
Queuing formulas to evaluate throughputs and servers
gptshubham
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
unit 3a.pptx material management. Chapter of operational management
atisht0104
 
AgentX UiPath Community Webinar series - Delhi
RohitRadhakrishnan8
 
Information Retrieval and Extraction - Module 7
premSankar19
 
Cryptography and Information :Security Fundamentals
Dr. Madhuri Jawale
 
Chapter_Seven_Construction_Reliability_Elective_III_Msc CM
SubashKumarBhattarai
 

Bubble sort | Data structure |

  • 1. SUBMITTED BY : Name : Saiful Islam Institute: Green University Of Bd ID : 162-015-022 Batch : 162 1
  • 2. What is bubble sort : Bubble short is A simple sorting algorithm. This sorting algorithm is comparison based algorithm in which each pair of adjacent elements is compared and elements are swapped if they are not in order . this algorithm is not suitable for large data sets as its average and worst case complexity are of 0(n2) where n are no. Of items. 2
  • 3. How bubble sort works? We take an unsorted array for our example. Bubble sort take 0(n2) time so we’re keeping short and precise. 3
  • 4. Sorting :  In this case, value 33 is greater than 14, so it is already in sorted locations. Next, we compare 33 with 27  Bubble sort starts with very first two elements, comparing them to check which one is greater. 4
  • 5. Sorting :  The new array should look like this -  We find that 27 is smaller than 33 and these two values must be swapped. 5
  • 6. Sorting :  Next we compare 33 and 35. We find that both are in already sorted position.  Then we move to next two values, 35 and 10.  We know than 10 is smaller 35. Hence they are not sorted. 6
  • 7. Sorting second time : First sort Second sort Third sort Fourth sort Now we should look into same practical aspects of bubble sort. 7
  • 8. Advantages :  It does not deal well with a list containing a huge number of items.  More than the number of comparisons.  The code become complex for large amount of data. Disadvantages :  Bubble sort is one of the easiest sort algorithm.  It is easy to implement.  Elements are swapped in place, not use extra array.  It is stable and fast. 8
  • 9. 9