def test_list_ordered_str(self): """ Test Bubble Sort with string values """ self.unordered_list.add("c") self.unordered_list.add("b") self.unordered_list.add("a") # First test so the unordered list is following the pattern # c -> b -> a current_node = self.unordered_list.head self.assertEqual(current_node.data, "c") current_node = current_node.next self.assertEqual(current_node.data, "b") current_node = current_node.next self.assertEqual(current_node.data, "a") # Bubble sort the list order should now be # a -> b -> c bubble_sort(self.unordered_list) current_node = self.unordered_list.head self.assertEqual(current_node.data, "a") current_node = current_node.next self.assertEqual(current_node.data, "b") current_node = current_node.next self.assertEqual(current_node.data, "c")
def test_list_ordered(self): """ Test Bubble Sort """ self.unordered_list.add(8) self.unordered_list.add(2) self.unordered_list.add(4) # First test so the unordered list is following the pattern # 8 -> 2 -> 4 current_node = self.unordered_list.head self.assertEqual(current_node.data, 8) current_node = current_node.next self.assertEqual(current_node.data, 2) current_node = current_node.next self.assertEqual(current_node.data, 4) # Bubble sort the list order should now be # 2 -> 4 -> 8 bubble_sort(self.unordered_list) current_node = self.unordered_list.head self.assertEqual(current_node.data, 2) current_node = current_node.next self.assertEqual(current_node.data, 4) current_node = current_node.next self.assertEqual(current_node.data, 8)
def test_empty_list_bubble_sort(self): """ Test if list is empty after sorting. """ self.ulist.remove("test node") sort.bubble_sort(self.ulist) self.assertTrue(self.ulist.is_empty())
def test_bubble(self): """test bubble sort""" #test if list is empty with self.assertRaises(NoValue): bubble_sort(self.num) with self.assertRaises(WrongType): self.num.add("hej") self.num.add("ord") bubble_sort(self.num)
def visualize_bubble_sort(lst, vis): start_time = time.perf_counter_ns() sort.bubble_sort(lst, vis) end_time = time.perf_counter_ns() vis.replay() vis.reset() print('Bubble Sort') print(f'Time: {end_time - start_time:,}ns\n')
def test_bubble_sort(): alist = range(10) random.shuffle(alist) ret = sort.bubble_sort(alist) assert ret == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
def test_sort(self): # Set up array to sort array_len = 1024 max_value = 1024 x = [random.randint(0, max_value) for i in range(array_len)] # Insertion sort self.assertEqual(sort.insertion_sort(x), sorted(x)) # Merge sort self.assertEqual(sort.merge_sort(x), sorted(x)) # Selection sort self.assertEqual(sort.selection_sort(x), sorted(x)) # Bubble sort self.assertEqual(sort.bubble_sort(x), sorted(x)) # Heap sort self.assertEqual(sort.heap_sort(x), sorted(x)) # Quick sort self.assertEqual(sort.quick_sort(x), sorted(x)) # Quick sort v2 self.assertEqual(sort.quick_sort_v2(x), sorted(x))
def handle_bubble_sort(self): """sort with bubble_sort() function""" try: print(bubble_sort(self.uol)) except WrongType: return print("Can't sort string.") except NoValue: return print("There are no elements to sort.")
def test_bubble_sort(): print "\nbubble sort begin" count = random.randint(100, 1000) for _ in range(count): length = random.randint(5, 30) source = tool.random_list(0, 100, length) target = sort.bubble_sort(source) if tool.list_is_ascend(target) is False: print source print target print "" assert (tool.list_is_ascend(target)) print "bubble sort success in {0} times.\n".format(count)
def test_populated_list_bubble_sort(self): """ Test lists are same after sorting. """ print() lst = [1, 3, 4, 8, 9] self.ulist.remove("test node") self.ulist.add(9) self.ulist.add(1) self.ulist.add(4) self.ulist.add(3) self.ulist.add(8) sort.bubble_sort(self.ulist) current_node = self.ulist.head for item in lst: if current_node.next != None: self.assertEqual(item, current_node.data) current_node = current_node.next
def graph_menu(): os.system('cls||clear') with open('disciplines.json') as f: disciplines = json.load(f) print('\033[1m'+'==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n') print('Estrutura de Dados 2 - Algoritmos de Ordenção O(n²)\n') print('==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n') print('Ordernar por : ' + '\n') print('[1] - Código da Matéria') print('[2] - Nome da Matéria') print('[3] - Sair') print('') print('\033[1m'+'==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n' + '\033[0m') param = int(input('>>>')) param = 'name' if (param > 1) else 'code' runtime = [] sort = ['Insertion Sort', 'Selection Sort', 'Bubble Sort'] start = time.time() i = insertion_sort(disciplines, param) end = time.time() runtime.append(end - start) with open('disciplines.json') as f: disciplines = json.load(f) start = time.time() i = selection_sort(disciplines, param) end = time.time() runtime.append(end - start) with open('disciplines.json') as f: disciplines = json.load(f) start = time.time() i = bubble_sort(disciplines, param) end = time.time() runtime.append(end - start) print(runtime) plt.figure(figsize=(10,5)) plt.barh(sort, runtime, color='blue') plt.xlabel('Tempo de execução') plt.show()
def binary_search(the_list, target_value): #Implements the Binary Search algorithm #First, sort the list sorted_list = bubble_sort(the_list) #Search for the target value #Find length of current segment. length = len(sorted_list) #initialize start and end variables start = 0 #this determines the start of the list end = length #this determines the end of the list #If length is >= 1, look for target while length >= 1: #find the current length and middle of the segment of the list we're looking in # Double slashes will give you a whole number, a single slash will give you a float(i.e. a decimal - ex: 2.0) mid = start + (length // 2) #once found, determine if middle value is greater or less than, or equal to and length #If equal, we've found it, return middle (this looks for the best case first) if sorted_list[mid] == target_value: return(sorted_list, mid) #If greater than, reduce segment to left half from middle elif sorted_list[mid] > target_value: length = len(sorted_list[start:mid]) end = mid #If less than, reduce segment to right half from middle elif sorted_list[mid] < target_value: start = mid + 1 #reevaluate length before the loop runs length = len(sorted_list[start:end]) #defalt response, oh crap - if we can't find the index, return -1 return(sorted_list, -1)
def binary_search(the_list, target_value): """Implements binary search algorithm.""" #Sort the list sorted_list = bubble_sort(the_list) # Search the target value # Find length of current segment, length = len(sorted_list) # Initialize start and end vars start = 0 end = length # If len >= 1, look for target while length >= 1: #Find mid point of the segment mid = start + (length // 2) # Determine if the middle value is greater or less than, or equal, #If equal, we've found it return middle if sorted_list[mid] == target_value: return(sorted_list, mid) #If greater, reduce the segment to the left half, repeat loop elif sorted_list[mid] > target_value: length = len(sorted_list[start:mid]) end = mid #If less, reduce the segment to the right half, repeat loop elif sorted_list[mid] < target_value: start = mid + 1 # Reeval length before loop runs length = len(sorted_list[start:end]) #IF we can't find the index, return -1 return (sorted_list, -1)
def binary_search(the_list, target_value): """Implements the Binary Search algorithm.""" # First, sort the list sorted_list = bubble_sort(the_list) # Search for the target value # Find length of current segment length = len(sorted_list) # Initialize start and end variables start = 0 end = length # if len >= 1, look for target: while length >= 1: # Find the middle of the segment of the list we're looking in mid = start + (length // 2) # Determine if middle value is greater or less than, or equal to # If equal, we've found it, return middle if sorted_list[mid] == target_value: return (sorted_list, mid) # If greater than, reduce segment to left half from middle, repeat loop elif sorted_list[mid] > target_value: end = mid # If less than, reduce segment to right half from middle, repeat loop elif sorted_list[mid] < target_value: start = mid + 1 # Reevaluate length before the loop runs length = len(sorted_list[start:end]) # If we can't find the index, return -1 return (sorted_list, -1)
def binary_search(the_list, target_value): """Implements the Binary Search algorithm""" # Sort the list using our own sort algorithm (imported above) sorted_list = bubble_sort(the_list) # Search for the target value # Find length of current segment length = len(sorted_list) # initialize start and end variables start = 0 end = length # Determine if middle value is >, <, == # If length >= 1, look for the target: while length >= 1: # Find the current middle point of the segment of the list mid = start + (length // 2) # If it equals the sought after number, number is found, return middle if sorted_list[mid] == target_value: return (sorted_list, mid) # If greater than, reduce segment to left of middle point, repeat loop elif sorted_list[mid] > target_value: end = mid # If less than, reduce segment to right of middle point, repeat loop elif sorted_list[mid] < target_value: start = mid + 1 # Find the current length of the string length = len(sorted_list[start:end]) # If we can't find the index, return -1 return (sorted_list, -1)
def binary_search(the_list, target_vaule): # first sor the list sorted_list = bubble_sort(the_list) # search for the target vaule # find len of current segment, length = len(sorted_list) # initialize start and end vari start = 0 end = length - 1 # if len>= 1, looking in target while length >= 1: # find the middle of the list mid = start + (length // 2) start = 0 end = length - 1 # determine if middle value is greater or less then, or equal # if equal we found it return middle if sorted_list[mid] == target_vaule: return (sorted_list, mid) # if greater than, reduce segment to left half from middle, repeat loop elif sorted_list[mid] > target_vaule: length = len(sorted_list[:mid]) end = mid # if less than reduce sefment to the rifht from the middle, repeat loop elif sorted_list[mid] < target_vaule: lenth = len(sorted_list[mid + 1 : end]) start = mid + 1 mid = start + (length // 2) # if we cant find th eindex return -1 return (sort_list, -1)
def bubble_sort_test(): A = [random.randrange(1, 2 ** 10) for i in range(24)] print(A) sort.bubble_sort(A) print(A)
from sort import bubble_sort, select_sort, merge_sort, quick_sort, shell_sort, heap_sort, insert_sort import time __author__ = 'Nan' myArr = [3, 1, 2, 4, 5, 6, 7, 1] sorted1 = bubble_sort(myArr) sorted2 = select_sort(myArr) print(sorted)
def main(): win = gp.GraphWin('sortpy', WINDOW_X, WINDOW_Y, autoflush=False) win.setBackground(color=gp.color_rgb(43, 137, 164)) print_logo() first_input = True while 1: clear_screen(win) ds = sort.generate_dataset(sort.DATA_NUM, repeat=False) bars = [] draw_bars(ds, win, bars) sort.playback_list = [] valid_command = False if first_input: command = input('Type help to view commands\n') first_input = False else: command = input('') while not valid_command: if command == 'help': print_header('Sorting algorithms') print_subheader('Bubble sorts') print_command('bubble', 'Bubble sort') print_command('cocktail', 'Cocktail shaker sort') print_command('comb', 'Comb sort') print_command('oddeven', 'Odd-even sort') print_subheader('Insertion sorts') print_command('insertion', 'Insertion sort') print_command('shell', 'Shellsort') print_command('gnome', 'Gnome sort') print_subheader('Divide and conquer') print_command('merge', 'Merge sort') print_command('quick', 'Quicksort') print_subheader('Other') print_command('selection', 'Selection sort') print_command('stooge', 'Stooge sort') print_header('Options') print_command('quit', 'Exit sortpy') print('\n') print('Click on the window after sorting finishes to select a new algorithm') command = input('\n') elif command == 'bubble': valid_command = True elif command == 'cocktail': valid_command = True elif command == 'comb': valid_command = True elif command == 'oddeven': valid_command = True elif command == 'insertion': valid_command = True elif command == 'shell': valid_command = True elif command == 'gnome': valid_command = True elif command == 'merge': valid_command = True elif command == 'quick': valid_command = True elif command == 'selection': valid_command = True elif command == 'stooge': valid_command = True elif command == 'quit': win.close() return else: print('Command not found - type help to view commands') command = input('\n') sort.playback_list.append(ds[:]) if command == 'insertion': sort.insertion_sort(ds) elif command == 'bubble': sort.bubble_sort(ds) elif command == 'cocktail': sort.cocktail_sort(ds) elif command == 'selection': sort.selection_sort(ds) elif command == 'merge': sort.merge_sort(ds, 0, sort.DATA_NUM - 1) elif command == 'quick': sort.quick_sort(ds, 0, sort.DATA_NUM - 1) elif command == 'shell': sort.shell_sort(ds) elif command == 'gnome': sort.gnome_sort(ds) elif command == 'oddeven': sort.odd_even_sort(ds) elif command == 'comb': sort.comb_sort(ds) elif command == 'stooge': sort.stooge_sort(ds, 0, sort.DATA_NUM - 1) sort.playback_list = remove_duplicates(sort.playback_list) play_animation(ds, win, bars) win.getMouse()
def test_bubble_sort(self): expected = [self.playerA, self.playerB, self.playerC] result = bubble_sort(self.chessPlayers) self.assertEqual(expected, result)
def test_bubble_sort(self): array = [7, 5, 1, 8, 3, 4, 4, 7, 3, 6, 2, 1, 8, 9, 0, 6] assert sort.bubble_sort(array) == [0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9]
def test_bubble_sort(): arr = [2, 3, 1, 8, 4, 5, 0] assert bubble_sort(arr) == sorted(arr)
def test_bubble_sort(array): t0 = time.time() sort.bubble_sort(array) t1 = time.time() print "Elapsed time (bubble sort): " + elapsed_to_str(t0, t1) + " sec."
def start(self): """ Start """ while True: print(""" [1] Check if the list is empty [2] Add value last in list [3] Insert value at a specific index [4] Replace value at a specific index [5] Show size of list [6] Show value at a specific index [7] Show index of a specific value [8] Show all values in the list [9] Remove node that match value [10] Sort list with Insertion Sort [11] Sort list with Bubble Sort [exit] Exit """) val = input('Choice: \n>>> ') if val == "1": print("\nCheck if the list is empty:") print(self.my_list.is_empty()) elif val == "2": print("\nAdd value last in list:") data = input("Value: ") self.my_list.add(data) elif val == "3": print("\nInsert value at a specific index:") index = input("Index: ") data = input("Value: ") try: self.my_list.insert(int(index), data) except IndexErrorException as e: print(e) elif val == "4": print("\nReplace value at a specific index:") index = input("Index: ") data = input("Value: ") try: self.my_list.set(int(index), data) except IndexErrorException as e: print(e) elif val == "5": print("\nShow size of list:") res = self.my_list.size() print(res) elif val == "6": print("\nShow value at a specific index:") data = input("Index: ") try: res = self.my_list.get(int(data)) print(res) except IndexErrorException as e: print(e) elif val == "7": print("\nShow index by value:") data = input("Value: ") try: res = self.my_list.index_of(data) print(res) except ValueErrorException as e: print(e) elif val == "8": print("\nShow all values in the list:") self.my_list.print_list() elif val == "9": print("\nRemove node by value:") data = input("Value: ") try: self.my_list.remove(data) except ValueErrorException as e: print(e) elif val == "10": print("\nSort list with Insertion Sort") insertion_sort(self.my_list) print(">> Unordered List now sorted with Insertion Sort <<") elif val == "11": print("Sort list with Bubble Sort") bubble_sort(self.my_list) print(">> Unordered List now sorted with Bubble Sort <<") elif val == "exit": sys.exit() else: print("No choice that match! try again")
def discipline_menu(): os.system('cls||clear') with open('disciplines.json') as f: disciplines = json.load(f) print('\033[1m'+'==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n') print('Estrutura de Dados 2 - Algoritmos de Ordenção O(n²)\n') print('==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n') print('Selecione uma opção de busca: ' + '\n') print('[1] - Selection Sort') print('[2] - Insertion Sort') print('[3] - Bubble Sort') print('[4] - Sair') print('') print('\033[1m'+'==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n' + '\033[0m') option = int(input('>>>')) while(option not in [1, 2, 3, 4]): option = int(input("Insira uma opção válida: ")) if(option == 4): sys.exit() os.system('cls||clear') print('\033[1m'+'==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n') print('Estrutura de Dados 2 - Algoritmos de Ordenção O(n²)\n') print('==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n') print('Ordernar por : ' + '\n') print('[1] - Código da Matéria') print('[2] - Nome da Matéria') print('[3] - Sair') print('') print('\033[1m'+'==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n' + '\033[0m') param = int(input('>>>')) while(option not in [1, 2, 3]): option = int(input("Insira uma opção válida: ")) if(param == 3): sys.exit() param = 'name' if (param > 1) else 'code' if(option == 1): start = time.time() disciplines = selection_sort(disciplines, param) end = time.time() runtime = end - start elif(option == 2): start = time.time() disciplines = insertion_sort(disciplines, param) end = time.time() runtime = end - start else: start = time.time() disciplines = bubble_sort(disciplines, param) end = time.time() runtime = end - start os.system('cls||clear') print('\033[1m'+'==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n') for i in range(0, 45): print(disciplines[i]['code'], '-', disciplines[i]['name']) print('\033[0m', '\n', 'Tempo de execução:', runtime) print('\n'+ '\033[1m' + '==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==\n' + '\033[0m')
import sort import time import random #再帰条件の変更 import sys sys.setrecursionlimit(100000) l = list(range(3000)) random.shuffle(l) start_time = time.time() sorted_list = sort.bubble_sort(l) print('time:{0:.3f}'.format(time.time()-start_time)) start_time = time.time() sorted_list = sort.selection_sort(l) print('time:{0:.3f}'.format(time.time()-start_time)) start_time = time.time() sorted_list = sort.insertion_sort(l) print('time:{0:.3f}'.format(time.time()-start_time)) start_time = time.time() sorted_list = sort.heap_sort(l) print('time:{0:.3f}'.format(time.time()-start_time)) start_time = time.time() sorted_list = sort.merge_sort(l) #print(sorted_list) print('time:{0:.3f}'.format(time.time()-start_time))
from sort import bubble_sort num_list = input("Write yor numbers separated by a space: ").split() bubble_sort(num_list) print(num_list)
return middle if middle_element < value: left = middle + 1 elif middle_element > value: right = middle - 1 def find(elements, value, key=identity): index = find_index(elements, value, key) return None if index is None else elements[index] arr = read_csv('chess-players.csv') sub_players = read_csv('players.csv') # sort players using bubble sort algarithm bubble_sort(arr) # find player with binary search for player in sub_players: print('****** Searching in progress.... *****') result = binary_search(arr, player) if (result): print("Player found in the list") print(f'First Name: {arr[result].fname}, Last Name: {arr[result].lname}, Country: {arr[result].country}, Born: {arr[result].born}, Died: {arr[result].died}') else: print("Not found Player")
import sort import sys if not sys.argv[1:]: print "Usage : python sort.py argv1 argv2 ..." exit() for a in range(len(sys.argv[1:])): try: sys.argv[a + 1] = int(sys.argv[a + 1]) except: print "input error" exit() print "quicksort" print sort.quicksort(sys.argv[1:]) print "\nbubblesort" print sort.bubble_sort(sys.argv[1:])
from sort import bubble_sort from sort import selection_sort import numpy as np print('Enter the array size n') array = np.zeros(int(input())) for j in range(np.size(array)): print('Enter a[', j, ']=') array[j] = int(input()) print('array:', array) print('which algorithm you want to use…\nbubble_sort : 1\nselection_sort: 2') b = int(input()) if b == 1: print('Bubble_sort:') bubble_sort(array) if b == 2: print('Selection_sort:') selection_sort(array) if b != 1 and b != 2: print('No sort') print(array)
def test_case02(self): A = [3, 1] print "origin A=%s" % A sort.bubble_sort(A) print "bubble sorted A=%s" % A self.assertTrue([1, 3] == A)
def test_case03(self): A = [3, 4, 5, 2, 1] print "origin A=%s" % A sort.bubble_sort(A) print "bubble sorted A=%s" % A self.assertTrue([1, 2, 3, 4, 5] == A)
# #list = sort.counting_sort([19,2,121,31,45,6,11,121,27],0,121,False) #print sort.check_sorted(list,False) # print '\ntesting and timing for a large array\n' list_large = [] for i in range(5000): list_large.append(random.randint(1, 100)) print 'size:5000, for the slower ones' timer = timer.Timer(time.clock()) #initialize the timer print 'bubble sort\n' list = sort.bubble_sort(list_large[:]) assert sort.check_sorted(list) timer.get_time(time.clock()) print '' print 'insertion sort\n' list = sort.insert_sort(list_large[:]) assert sort.check_sorted(list) timer.get_time(time.clock()) print '' print 'insertion sort fast\n' list = sort.insert_sort_fast(list_large[:]) assert sort.check_sorted(list) timer.get_time(time.clock()) print ''
import random # ╣╪хКвт╪╨п╢╣дsort.oy import sort # иЗЁир╩╦Ж╢с1╣╫1000╣дlist ls = list() for i in range(1000): ls.append(i) # ╥ж╠Псц╪╦жжеепРкЦ╥╗╤тфДеепР # еепРж╝г╟ё╛сцrandom.shuffle╫╚фД╢Рбр # ц╟ещеепР random.shuffle(ls) time_start = time.clock() sort.bubble_sort(ls) print("ц╟ещеепРсцй╠: % s" % (time.clock() - time_start)) # я║тЯеепР random.shuffle(ls) time_start = time.clock() sort.select_sort(ls) print("я║тЯеепРсцй╠: % s" % (time.clock() - time_start)) # ╡ЕхКеепР random.shuffle(ls) time_start = time.clock() sort.insert_sort(ls) print("╡ЕхКеепРсцй╠: % s" % (time.clock() - time_start)) # оё╤ШеепР
# иЗЁир╩╦Ж╢с1╣╫1000╣дlist ls = list() for i in range(1000): ls.append(i) # ╥ж╠Псц╪╦жжеепРкЦ╥╗╤тфДеепР # еепРж╝г╟ё╛сцrandom.shuffle╫╚фД╢Рбр # ц╟ещеепР random.shuffle(ls) time_start = time.clock() sort.bubble_sort(ls) print ("ц╟ещеепРсцй╠: % s" %(time.clock() - time_start) ) # я║тЯеепР random.shuffle(ls) time_start = time.clock() sort.select_sort(ls) print ("я║тЯеепРсцй╠: % s" %(time.clock() - time_start) ) # ╡ЕхКеепР random.shuffle(ls) time_start = time.clock() sort.insert_sort(ls) print ("╡ЕхКеепРсцй╠: % s" %(time.clock() - time_start) ) # оё╤ШеепР
def test_bubble_sort(self): """ Test Bubble Sort. read sort.py for instructions. """ sample = [3, 1, 10, 5, 654, 45, 8, 5, 31, 123] sorted_sample = [1, 3, 5, 5, 8, 10, 31, 45, 123, 654] self.assertEqual(sorted_sample, sort.bubble_sort(sample))
def test_search_not_found(self): bubble_sort(self.players) result = binary_search(self.players, self.playerA) self.assertNotEqual(result, self.playerA)
from sort import seletion_sort, bubble_sort, quick_sort arr = [2, 42, 84, 5, 113, 4, 6, 33, 65, 756] sorted = [2, 4, 5, 6, 33, 42, 65, 84, 113, 756] reversed = [756, 113, 84, 65, 42, 33, 6, 5, 4, 2] sorted_arr = seletion_sort(arr) assert (sorted_arr == sorted) reversed_arr = seletion_sort(arr, True) assert (reversed_arr == reversed) sorted_arr = bubble_sort(arr) assert (sorted_arr == sorted) reversed_arr = bubble_sort(arr, True) assert (reversed_arr == reversed) sorted_arr = quick_sort(arr) assert (sorted_arr == sorted) reversed_arr = quick_sort(arr, True) assert (reversed_arr == reversed)
def test_bubble_sort_algorithm(self): expected = [self.playerC, self.playerB, self.playerA] result = bubble_sort(self.chessPlayers) self.assertNotEqual(expected, result)
sort.comb_sort(b) print b b = a[:] sort.shell_sort(b) print b b = a[:] sort.shell_sort(b, None, 'shell') print b b = a[:] sort.shell_sort(b, None, 'cuira') print b b = a[:] sort.insertion_sort(b) print b b = a[:] sort.coctail_sort(b) print b b = a[:] sort.selection_sort(b) print b b = a[:] sort.bubble_sort(b) print b