from SoSe24.algodat.foundation import AlgoDatArray, AlgoDatValue, read_int_sequence, read_int_sequence_limited import matplotlib import matplotlib.pyplot as plt import hash_table as ht if __name__ == "__main__": filename = "../../seq3.txt" dummy = read_int_sequence(filename) n = len(dummy) step = n // 100 memory_values = [] compare_values = [] alpha_values = [] for right_end in range(1, n, step): AlgoDatValue.reset() z = read_int_sequence_limited(filename, right_end) hash = ht.HashTable(int(right_end*2), hash_function=ht.h, exploratory_function=ht.f1) for i in z: hash.insert(i) memory_values.append(AlgoDatValue.memory) compare_values.append(AlgoDatValue.compare) alpha_values.append(hash.alpha()) plt.plot(range(1, n, step), memory_values, 'b', label='Memory') plt.plot(range(1, n, step), compare_values, 'r', label='Compare') plt.plot(range(1, n, step), alpha_values, 'g', label='Alpha') plt.legend() plt.show()