# list of teams
teams = [
('Liverpool', 'Premier League', 1892, 'Football', 100000000),
('Golden State Warriors', 'NBA', 1946, 'Basketball', 150000000),
('New York Yankees', 'MLB', 1901, 'Baseball', 120000000),
('Toronto Maple Leafs', 'NHL', 1917, 'Ice Hockey', 80000000)
]

# bubble sort teams by price ascending
def bubble_sort(teams):
    n = len(teams)
    for i in range(n):
        for j in range(0, n-i-1):
            if teams[j][4] > teams[j+1][4]:
                teams[j], teams[j+1] = teams[j+1], teams[j]
    return teams

sorted_teams = bubble_sort(teams)
print("Teams sorted by value:")
for team in sorted_teams:
    print(team)
    
# insertion sort teams by year of organization descending
def insertion_sort(teams):
    for i in range(1, len(teams)):
        key = teams[i]
        j = i-1
        while j >=0 and key[2] > teams[j][2]:
            teams[j+1] = teams[j]
            j -= 1
        teams[j+1] = key
    return teams

sorted_teams = insertion_sort(teams)
print("Teams sorted by year of establishment:")
for team in sorted_teams:
    print(team)

# selection sort teams by league name alphabetical
def selection_sort(teams):
    for i in range(len(teams)):
        min_index = i
        for j in range(i+1, len(teams)):
            if teams[j][0] < teams[min_index][0]:
                min_index = j
        teams[i], teams[min_index] = teams[min_index], teams[i]
    return teams

sorted_teams = selection_sort(teams)
print("Teams sorted by team name:")
for team in sorted_teams:
    print(team)
Teams sorted by value:
('Toronto Maple Leafs', 'NHL', 1917, 'Ice Hockey', 80000000)
('Liverpool', 'Premier League', 1892, 'Football', 100000000)
('New York Yankees', 'MLB', 1901, 'Baseball', 120000000)
('Golden State Warriors', 'NBA', 1946, 'Basketball', 150000000)
Teams sorted by year of establishment:
('Golden State Warriors', 'NBA', 1946, 'Basketball', 150000000)
('Toronto Maple Leafs', 'NHL', 1917, 'Ice Hockey', 80000000)
('New York Yankees', 'MLB', 1901, 'Baseball', 120000000)
('Liverpool', 'Premier League', 1892, 'Football', 100000000)
Teams sorted by team name:
('Golden State Warriors', 'NBA', 1946, 'Basketball', 150000000)
('Liverpool', 'Premier League', 1892, 'Football', 100000000)
('New York Yankees', 'MLB', 1901, 'Baseball', 120000000)
('Toronto Maple Leafs', 'NHL', 1917, 'Ice Hockey', 80000000)