QUESTION:12
To accept a set of 20 integers in a single dimensional array. Sort the numbers in ascending
order by using the Bubble sort technique. Display the sorted aray
LuckyYadav2578:
language?
Answers
Answered by
4
Bubble sort technique in python
a = [ ]
b = int (input ( " enter the length of list " ) )
for i in range (b) :
______ n = int ( input (" enter numbers of list ") )
______ a.append (n)
for j in range ( b ):
______ for k in range ( b - j ) :
___________ if (a [ k ] > [ k + 1] );
___________________ t = a [k]
___________________ a [k] = a [ k + 1]
___________________ a [ k + 1 ] = t
print (" no. after sorting in ascending order ")
print (a)
note : I am using --> ______ for indentation.
Similar questions
India Languages,
6 months ago
Science,
6 months ago
Science,
1 year ago
English,
1 year ago
Biology,
1 year ago