python 3.x - I'm trying to make a function that sorts a list using bubble sorting and returns the number of swaps -


def improve_bubble_sort(list_of_values):     count = 0     in range(len(list_of_values)):         j in range(len(list_of_values)-1,i,-1):             if list_of_values[j]<list_of_values[j-1]:                 count += 1                 bubble(values)      count += 1     return count 

i want know whats wrong code, when test print(improved_bubble_sort([1, 2, 3, 4, 5, 6]) count comes 6 instead of 5 :/ bubble(values) code refers code correct. great !!


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

post - imageshack API cURL -

dataset - MPAndroidchart returning no chart Data available -