Bubble sort in Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Bubble sort in Python

Can you bubble sort OBJECTS in Python ? Can this lead to MEMORY LEAKS in the system ?

28th Oct 2020, 2:51 PM
Sanjay Kamath
Sanjay Kamath - avatar
4 Answers
+ 3
You can sort anything that can be compared. You can provide a custom comparator function to your sorting function if you want. Python also provides magic methods for comparisons. Memory leaks: I don't think so, but I might be wrong.
28th Oct 2020, 9:11 PM
Kevin ★
+ 1
EVERY thing in Python is an object. So if you do any kind of bubble sort in Python, you are doing this with objects.
28th Oct 2020, 3:02 PM
Coding Cat
Coding Cat - avatar
+ 1
Yes you can bubble sort.
28th Oct 2020, 3:03 PM
Maxwell Anderson
Maxwell Anderson - avatar
+ 1
Kevin ★ Thanks for your reply.... 🤔 Most likely to be true....
29th Oct 2020, 2:18 AM
Sanjay Kamath
Sanjay Kamath - avatar