All checks were successful
Deploy to Homelab / deploy (push) Successful in 6s
25 lines
522 B
Python
25 lines
522 B
Python
class Node:
|
|
prev_node = None
|
|
|
|
def __init__(self, value) -> None:
|
|
self.value = value
|
|
|
|
class Stack:
|
|
top: None | Node = None
|
|
|
|
def add(self, value):
|
|
# Implement as an exercise
|
|
pass
|
|
|
|
def remove(self) -> None | Node:
|
|
# Implement as an exercise
|
|
pass
|
|
|
|
def peek(self) -> None | Node:
|
|
# Implement as an exercise
|
|
pass
|
|
|
|
# Homework:
|
|
# - Implement the other methods on the stack
|
|
# - Implement linked list methods (see homework from 2026.01.28)
|