from SoSe24.algodat.foundation import AlgoDatArray, AlgoDatValue, read_int_sequence, read_int_sequence_limited import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import bin_tree as bt if __name__ == "__main__": filename = "../../seq3_sorted.txt" #filename = "../../seq3.txt" dummy = read_int_sequence(filename) n = len(dummy) step = n // 100 memory_values = [] compare_values = [] for right_end in range(1, n, step): AlgoDatValue.reset() z = read_int_sequence_limited(filename, right_end) tree = bt.BinTree() for i in z: tree.insert(i) memory_values.append(AlgoDatValue.memory) compare_values.append(AlgoDatValue.compare) print(right_end, AlgoDatValue.compare) plt.plot(range(1, n, step), memory_values, 'b', label='Memory') plt.plot(range(1, n, step), compare_values, 'r', label='Compare') plt.legend() plt.show()