def bubblesort(x):
	"""
	Bubble sort: iterate through list n times, swapping adjacent neighbors if they are out of order
	"""
	assignments = 0
	conditionals = 0
	length = len(x)
	if length < 2:
		return x,0,0
	for iteration in range(length-1):
		for index in range(length-1):
			conditionals += 1
			if x[index] >= x[index+1]:
				assignments += 2
				new_value = x[index+1]
				x[index+1] = x[index]
				x[index] = new_value
	return x, assignments, conditionals