SlideShare a Scribd company logo
1 of 22
Download to read offline
GVK CHINMAYA VIDYALAYA
SENIOR SECONDARY SCHOOL
Kothuru, Indukurupet, SPS Nellore
BUBBLE SORT
Class: 12 Subject: Python Teacher: C Vijaya Kumar
B.Tech,MBA
16 12 18 13 14 17
i=0
j=0
For (0<5)
True
Arr[0] > Arr[1] True Swap
12 16 18 13 14 17
i=0
j=1
For (1<5)
True
Arr[1] > Arr[2] False No swap
12 16 18 13 14 17
i=0
j=2
For (2<5)
True
Arr[2] > Arr[3] True swap
12 16 13 18 14 17
i=0
j=3
For (3<5)
True
Arr[3] > Arr[4] True swap
12 16 13 14 18 17
i=0
j=4
For (4<5)
True
Arr[4] > Arr[5]
True swap
12 16 13 14 17 18
i=0
j=5
For (5<5)
False
12 16 13 14 17 18
i=1
j=0
For (0<4)
True
Arr[0] > Arr[1]
False no swap
12 16 13 14 17 18
i=1
j=1
For (1<4)
True
Arr[1] > Arr[2]
True swap
12 13 16 14 17 18
i=1
j=2
For (2<4)
True
Arr[2] > Arr[3]
True swap
12 13 14 16 17 18
i=1
j=3
For (3<4)
True
Arr[3] > Arr[4]
True swap
12 13 14 16 17 18
i=1
j=4
for(False)
12 13 14 16 17 18
i=2
j=0
for(0<3)
Arr[0] > Arr[1]
False No Swap
12 13 14 16 17 18
i=2
j=1
for(1<3)
Arr[1] > Arr[2]
False No Swap
12 13 14 16 17 18
i=2
j=2
for(2<3)
Arr[2] > Arr[3]
False No Swap
12 13 14 16 17 18
i=2
j=3
for(3<3)
false
False No Swap
12 13 14 16 17 18
i=3
j=0
for(0<2)
true
Arr[0] > Arr[1]
False no swap
12 13 14 16 17 18
i=3
j=1
for(1<2)
true
Arr[1] > Arr[2]
False no swap
12 13 14 16 17 18
i=3
j=2
for(2<2)
false
12 13 14 16 17 18
i=4
j=0
for(0<1)
True
Arr[0] > Arr[1]
False no Swap
12 13 14 16 17 18
i=4
j=1
for(1<1)
False
12 13 14 16 17 18
i=5
j=0
for(0<0)
False

More Related Content

What's hot (8)

Tugas 2 turunan
Tugas 2 turunanTugas 2 turunan
Tugas 2 turunan
 
Practica 1 numeros naturales y enteros
Practica 1 numeros naturales y enterosPractica 1 numeros naturales y enteros
Practica 1 numeros naturales y enteros
 
Ejercicios: Círculo y parábola
Ejercicios: Círculo y parábolaEjercicios: Círculo y parábola
Ejercicios: Círculo y parábola
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
Recursive functions in C
Recursive functions in CRecursive functions in C
Recursive functions in C
 
Final exam g8 correction
Final exam g8 correctionFinal exam g8 correction
Final exam g8 correction
 
ضرب وحيدات الحد
ضرب وحيدات الحدضرب وحيدات الحد
ضرب وحيدات الحد
 
Absolute Value Notes
Absolute Value NotesAbsolute Value Notes
Absolute Value Notes
 

More from chinthala Vijaya Kumar

More from chinthala Vijaya Kumar (9)

GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
GVKCV Computer Science(083) Pre board sample paper 2 Class 12 (20-21) with so...
 
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
Computer Science(083) Python Pre Board Exam 1 Sample Paper Class 12
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
 
Binary search in Python using recursion
Binary search in Python using recursionBinary search in Python using recursion
Binary search in Python using recursion
 
Data visualization pyplot
Data visualization pyplotData visualization pyplot
Data visualization pyplot
 
Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11Data handling CBSE PYTHON CLASS 11
Data handling CBSE PYTHON CLASS 11
 
Python Fundamentals Class 11
Python Fundamentals Class 11Python Fundamentals Class 11
Python Fundamentals Class 11
 
File handling CBSE CLASS 12
File handling CBSE CLASS 12File handling CBSE CLASS 12
File handling CBSE CLASS 12
 
Recursion CBSE Class 12
Recursion CBSE Class 12Recursion CBSE Class 12
Recursion CBSE Class 12
 

Recently uploaded

MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdfOrientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdf
Elizabeth Walsh
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 

Recently uploaded (20)

How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfDiuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdfOrientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 

Bubble sort

  • 1. GVK CHINMAYA VIDYALAYA SENIOR SECONDARY SCHOOL Kothuru, Indukurupet, SPS Nellore BUBBLE SORT Class: 12 Subject: Python Teacher: C Vijaya Kumar B.Tech,MBA
  • 2. 16 12 18 13 14 17 i=0 j=0 For (0<5) True Arr[0] > Arr[1] True Swap
  • 3. 12 16 18 13 14 17 i=0 j=1 For (1<5) True Arr[1] > Arr[2] False No swap
  • 4. 12 16 18 13 14 17 i=0 j=2 For (2<5) True Arr[2] > Arr[3] True swap
  • 5. 12 16 13 18 14 17 i=0 j=3 For (3<5) True Arr[3] > Arr[4] True swap
  • 6. 12 16 13 14 18 17 i=0 j=4 For (4<5) True Arr[4] > Arr[5] True swap
  • 7. 12 16 13 14 17 18 i=0 j=5 For (5<5) False
  • 8. 12 16 13 14 17 18 i=1 j=0 For (0<4) True Arr[0] > Arr[1] False no swap
  • 9. 12 16 13 14 17 18 i=1 j=1 For (1<4) True Arr[1] > Arr[2] True swap
  • 10. 12 13 16 14 17 18 i=1 j=2 For (2<4) True Arr[2] > Arr[3] True swap
  • 11. 12 13 14 16 17 18 i=1 j=3 For (3<4) True Arr[3] > Arr[4] True swap
  • 12. 12 13 14 16 17 18 i=1 j=4 for(False)
  • 13. 12 13 14 16 17 18 i=2 j=0 for(0<3) Arr[0] > Arr[1] False No Swap
  • 14. 12 13 14 16 17 18 i=2 j=1 for(1<3) Arr[1] > Arr[2] False No Swap
  • 15. 12 13 14 16 17 18 i=2 j=2 for(2<3) Arr[2] > Arr[3] False No Swap
  • 16. 12 13 14 16 17 18 i=2 j=3 for(3<3) false False No Swap
  • 17. 12 13 14 16 17 18 i=3 j=0 for(0<2) true Arr[0] > Arr[1] False no swap
  • 18. 12 13 14 16 17 18 i=3 j=1 for(1<2) true Arr[1] > Arr[2] False no swap
  • 19. 12 13 14 16 17 18 i=3 j=2 for(2<2) false
  • 20. 12 13 14 16 17 18 i=4 j=0 for(0<1) True Arr[0] > Arr[1] False no Swap
  • 21. 12 13 14 16 17 18 i=4 j=1 for(1<1) False
  • 22. 12 13 14 16 17 18 i=5 j=0 for(0<0) False