
# input is a list
# output is the list with all
# the elements in ascending,
# sorted order
def bubblesort(list):
    print("unsorted list:", list)
    temp = 0
    current = 0
    i = 1
    while(i < len(list)):
        current = 0
        print("=====ITERATION" ,str(i)+"=====")
        while(current < len(list)-1):
            #sort logic goes here
            if(list[current] > list[current+1]):
                #DEBUG
                print("swapping:", list[current], "and", list[current+1])
                temp = list[current+1]
                list[current+1] = list[current]
                list[current] = temp
            current += 1
        print("current state:", list)
        i += 1
    return list


# MAIN PROGRAM

list = [4,3,2,1]
sorted = bubblesort(list)
print(sorted)
list = ['b','c','d','a']
sorted = bubblesort(list)
print(sorted)
list = ['adam','andrea','aaron','abigail']
sorted = bubblesort(list)
print(sorted)
# need to compare only strings to get this to work
#list = [1, 'john', 2, 'jane']
#sorted = bubblesort(list)
#print(sorted)
