Sorting algorithms/Bubble sort: Difference between revisions

Line 167:
 
Python has a built in sort method:
 
>>> foo = [3, 5, 2, 6, 1]
 
>>> foo
>>> foo = [3, 5, 2, 6, 1]
>>> foo.sort()
>>> foo = [3, 5, 2, 6, 1]
>>> foo
>>> foo.sort()
[1, 2, 3, 5, 6]
>>> foo
[1, 2, 3, 5, 6]
 
The built-in sort is not a bubble sort. TODO: I'm not sure what sort the python built-in is, but I'd imagine its fairly efficient.
Anonymous user