From fe69f324849577f06d64dbd6fe93296dc7cfeebf Mon Sep 17 00:00:00 2001 From: hofmannol Date: Tue, 9 Apr 2024 16:07:35 +0200 Subject: [PATCH] foundation --- SoSe24/algodat/foundation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SoSe24/algodat/foundation.py b/SoSe24/algodat/foundation.py index 80e35ed..b2a803a 100644 --- a/SoSe24/algodat/foundation.py +++ b/SoSe24/algodat/foundation.py @@ -250,7 +250,9 @@ class AlgoDatArray: def __init__(self, size): self.size = size - self.array = [AlgoDatValue(None)] * size + self.array = [] + for i in range(size): + self.array.append(AlgoDatValue(None)) def set(self, index, value): assert isinstance(value, AlgoDatValue) @@ -323,6 +325,7 @@ def read_int_sequence(filename: str) -> AlgoDatArray: with open(filename, "r") as file: l = list(map(int, file.read().split())) a = AlgoDatArray(len(l)) + AlgoDatValue.memory -= len(l) for i in range(len(l)): a.set(i, AlgoDatValue(l[i])) return a