def setUp(self):
     """set up test case."""
     self.hash_table = HashTable()
     self.hash_table["march 6"] = 130
     self.hash_table["march 17"] = 204
     self.hash_table["march 24"] = 210
     self.hash_table["march 30"] = 207
Exemplo n.º 2
0
    if len(argv) < 3:
        exit('usage: ./main.py --type <' + '|'.join(data_structures) + '>')

    chosen_data_structure = argv[2]

    if argv[1] == '--type' and argv[2] not in data_structures:
        exit('invalid options')

    # default data structure
    data_structure = RBT()

    if chosen_data_structure == 'bst':
        data_structure = BST()
    elif chosen_data_structure == 'hmap':
        data_structure = HashTable(size=11549)

    # measure many different thigns
    actions_performed_count = dict()
    actions_performed_total_time = dict()
    actions_available = ['insert', 'load', 'delete',
                         'find', 'min', 'max', 'successor', 'inorder']
    for a in actions_available:
        actions_performed_count[a] = 0
        actions_performed_total_time[a] = 0

    # measure total program running time
    total_running_time = 0
    # remember the maximum amount of items stored
    max_items_stored = 0