|
1234567891011121314151617181920212223242526272829 |
- 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 avl_tree as avl
-
- 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 = avl.AVLTree()
- for i in z:
- tree.insert(i)
- memory_values.append(AlgoDatValue.memory)
- compare_values.append(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()
|