def handle_bst_random(size): bst = BinarySearchTree() array = fill_random(size) times = measure_time(array, bst) print('BST, append, {} size, random, {} s'.format( size, round(times['append'] / size, 5))) print('BST, find, {} size, random, {} s'.format( size, round(times['find'] / size, 5)))
def handle_linked_random(size): linked_list = LinkedList() array = fill_random(size) times = measure_time(array, linked_list) print('LL, append, {} size, random, {} s'.format( size, round(times['append'] / size, 5))) print('LL, find, {} size, random, {} s'.format( size, round(times['find'] / size, 5)))
def test_insertion_sort(array): # in order to not mutate array directly here copy of array is being made array_copy = array measure_time(insertion_sort, array_copy)
def test_execution_time(algorithm, test_set, test_set_name): # in order to not mutate array directly here copy of array is being made test_set_copy = test_set run_time = measure_time(algorithm, test_set_copy, is_quick_sort(algorithm)) print('{} at {} test set took {} ms'.format(algorithm, test_set_name, run_time))