hey guys.i have one realy big big problem.. My programming teacher gave my a task to get these functions to work, but i dont know python program so good.. thats why maybe someone of you could help me, and make these 3 functions to work .:).. please!! these lines are not in corect order, and they nedd to be in another place..
for j in range(i, 0, -1):
def bubble(l):
l[j], l[j-1] = l[j-1], l[j]
for j in range(len(l)-1, i, -1):
return l
k = j
def selection(l):
for i in range(0, len(l)):
if not swapped:
break
for i in range(0, len(l)):
if l[j] > l[j-1]:
break
k = i
def insertion(l):
for j in range(i+1, len(l)):
if l[j] < l[j-1]:
l[j], l[j-1] = l[j-1], l[j]
return l
swapped = True
if l[j] < l[k]:
for i in range(1, len(l)):
l, l[k] = l[k], l
return l
swapped = False