Computer Science, asked by abigail9, 1 year ago


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?
abigail9: java

Answers

Answered by LuckyYadav2578
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.


abigail9: I needed in java btw
abigail9: thank you anyways
abigail9: and I couldn't understand what u did here
LuckyYadav2578: i m really very sorry than
MauryaAJ: hii
MauryaAJ: you forgot me
abigail9: I have no clue who you are sorry
Similar questions