10+ Bubble Sort Programs (Solved) in python -practice questions

Share with others

bubble sort programs
bubble sort programs

Bubble Sort Programs for Practice

Q1. Write a program to arrange the following list in ascending order using bubble sort.

Original List = [23, 34, 54, 2, 12, 28]

Output List = [2, 12, 23, 28, 34, 54]



Q2. Write a program to arrange all alphabets of “csiplearninghub” into descending order using bubble sort.

Q3. Write a program to accept five names from user and arrange in increasing order using bubble sort.

Q4. Write a program to accept numbers from the user till the user enter ZERO and store them in a list. After that arrange them in increasing order using bubble sort.

Q5. After how many passes the given list will be sorted in increasing order using bubble sort? L = [23, 34, 54, 2, 12, 28]

bubble sort programs
bubble sort programs

Q6. Write the status of L = [56, 34, 23, 67, 98, 85] after first and second pass in bubble sort for arranging in increasing order.

Q7. Write the status of L = [60, 70, 40, 30, 50, 10] after first and second pass in bubble sort for arranging in decreasing order.

Q8. Show the status of L = [201, 301, 101, 901, 601, 401] after first and second pass of arranging elements in ascending order using bubble sort.

Q9. Write the status after all the passes when given List L = [22, 25, 65, 35, 81, 44] is arranged in ascending order using bubble sort.


Q10. How many times the outer loop will execute in bubble sort for given list. L [ 25, 12, 56, 34, 23, 98, 29, 4]

bubble sort programs
bubble sort programs

Q11. Show the status of L = [‘a’, ‘A’, ‘b’ , ‘B’, ‘c’, ‘C’, ‘d’, ‘D’] after first and second pass of arranging elements in ascending order using bubble sort.

Ans. Status are as follows

After First Pass : L = ['A', 'a', 'B',  'b', 'C', 'c', 'D', 'd']

After Second Pass : L = ['A', 'B', 'a', 'C', 'b', 'D', 'c', 'd']
bubble sort programs
bubble sort programs

Disclaimer : I tried to give the correct code of all the above bubble sort programs . If you feel that there is some error in the code of the above bubble sort programs, please send me the correct code/word/spelling at csiplearninghub@gmail.com so that i can correct it and also share your valuable feedback regarding above article.

Class 12 Computer Science Sample Paper 2020-2021.

Class 12 Computer Science Sample Paper Marking Scheme

Class 12 Computer Science Test Series


Share with others

Leave a Reply

error: Content is protected !!