Did weeks 10-12

This commit is contained in:
Aaro Koivukangas
2026-03-26 17:03:42 +02:00
parent fc081ca68e
commit ac39ef540a
16 changed files with 695 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import collections
import time
def stack(n):
start = time.time()
stack = collections.deque()
for x in range(n):
stack.append(x)
add_end = time.time()
for x in range(n):
stack.popleft()
end = time.time()
return f"Total: {end - start:.2f} seconds, to add: {add_end - start:.2f}, to delete: {end - add_end:.2f}"
def main():
print(stack(10**5))
if __name__ == "__main__":
main()