Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bubble sort #565

Closed
Srujan-Rao opened this issue Oct 4, 2022 · 5 comments
Closed

Bubble sort #565

Srujan-Rao opened this issue Oct 4, 2022 · 5 comments
Assignees

Comments

@Srujan-Rao
Copy link
Contributor

add bubble sort

@Samar1110
Copy link
Contributor

Samar1110 commented Oct 4, 2022

Hello Srujan Rao, can i submit a PR on this issue ?

@avigarg820
Copy link

``from sys import stdin

def bubbleSort(arr, n) :
for i in range(n-1):
for j in range(n-i-1):
if arr[j]> arr[j+1]:
temp = arr[j]
arr[j]= arr[j+1]
arr[j+1] = temp

#Taking Input Using Fast I/O
def takeInput() :
n = int(stdin.readline().strip())
if n == 0 :
return list(), 0

arr = list(map(int, stdin.readline().strip().split(" ")))
return arr, n

#to print the array/list
def printList(arr, n) :
for i in range(n) :
print(arr[i], end = " ")
print()

#main
t = int(stdin.readline().strip())

while t > 0 :

arr, n = takeInput()
bubbleSort(arr, n)
printList(arr, n)

t-= 1

@avigarg820
Copy link

add bubble sort

I am submitting a code of bubble sort in python. I hope it is ok

@harshhes
Copy link

harshhes commented Oct 8, 2022

hey there can i add bubble sort in python solution?

@Yashmittal01
Copy link

please assign it to me

@sbmxc sbmxc closed this as completed Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants