Bubble sort may be horrible and slow etc, but would you rather have an O(N^2) algorithm over 100 items, or O(1) one that required a dial-up connection?
And a list of 100 itmes shouldnt take 2 hours. I don't know python, but are you by any chance copying entire lists when you make those assignments?
Here's a bubble sort in Python from Google:
def bubbleSort(theList, max):
for n in range(0,max): #upper limit varies based on size of the list
temp = 0
for i in range(1, max): #keep this for bounds purposes
temp = theList[i]
if theList[i] < theList[i-1]:
theList[i] = theList[i-1]
theList[i-1] = temp
and another, from wikipedia:
def bubblesort(l):
"Sorts l in place and returns it."
for passesLeft in range(len(l)-1, 0, -1):
for index in range(passesLeft):
if l[index] < l[index + 1]:
l[index], l[index + 1] = l[index + 1], l[index]
return l
The order of bubble sort is N(N-1). This is essentially N^2, because for every element you require to scan the list and compare every element.
By the way, you will probably find C++ to be the fastest, then Java, then Python.