matplotlib_available = True try: from matplotlib import pyplot as plt from matplotlib import patches as mpatches except ImportError: matplotlib_available = False TOTAL_OPERATIONS_TO_PERFORM = 100000 BLOCK_OF_OPERATIONS = 10000 NUMBER_OF_BUCKETS = 251 SLEEPTIME = 1 ### DOUBLE LINKED LIST IMPLEMENTATION BENCHMARK ------------------------- print( "STARTING HT_LIST BENCHMARK" ) ht_list = HashTable( n_buckets=NUMBER_OF_BUCKETS, implementation="LIST" ) # create a fake user with the right set of operations fake_user_ht_list = HT_Fake_User( hash_table=ht_list, total_operations=TOTAL_OPERATIONS_TO_PERFORM, insert_percentage=75, search_percentage=12.5, delete_percentage=12.5 ) # list that holds the time of insert for each n_operations number ht_list_time_list = [] list_alpha_charge = [] while fake_user_ht_list.are_there_operations_to_perform(): # perform operations fake_user_ht_list.perform( operations=BLOCK_OF_OPERATIONS )
kv_bst.insert( key= -2 , value="calamen" , verbose=True ) kv_bst.insert( key= -0.5, value="calamen" , verbose=True ) print( kv_bst ) node = kv_bst.search( key=-1 ) print(node) print("found node with value", node.get_value() ) #kv_bst.search( key=10) kv_bst.delete( 0 , verbose=True ) kv_bst.delete( -0.5, verbose=True ) #kv_bst.delete( -0.5, verbose=True ) print( kv_bst ) ''' ht_bst = HashTable( n_buckets=997, implementation='BST' ) try: ht_bst.put( key="10", value="gigi", verbose=True) except Exception as e: print( e ) try: ht_bst.put( key="20", value="maicol", verbose=True) except Exception as e: print( e ) try: ht_bst.put( key="30", value="sandra", verbose=True) except Exception as e: print( e )