Bubble Sort | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Bubble Sort

Can you implement the bubble sort on a tuple

12th Apr 2019, 4:39 AM
Sanjay Kamath
Sanjay Kamath - avatar
6 Answers
+ 1
Actually you can sort tuples using sorted() but it will return a list
12th Apr 2019, 8:44 AM
BiswaViraj
BiswaViraj - avatar
+ 4
A tuple is immutable. That's the question 😂
12th Apr 2019, 6:09 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
There is also shell sort
12th Apr 2019, 5:00 AM
Da2
Da2 - avatar
+ 2
Then there is binary tree sort
12th Apr 2019, 6:11 AM
Da2
Da2 - avatar
+ 1
That largely depends on why you need a list sorted....
12th Apr 2019, 9:05 AM
Da2
Da2 - avatar
+ 1
You can turn it into a list, then sort it, then back into a tuple🤔 ill see if I can alter my bubble sort to do it mmmm OK😁 Here is my implementation: https://code.sololearn.com/cVpKbQ3fluqq/?ref=app
23rd Apr 2019, 8:27 AM
Trigger
Trigger - avatar