Visualize how undo works using a stack implemented with nodes!
Hi! I'm Teju 👋 We're building the undo system for a text editor using a stack.
Each typing action or change is saved as an "action ID". Pressing Ctrl+Z pops the latest action to undo it.
Operations:
PUSH x → Save new action x
POP → Undo (remove latest action)
PEEK → See latest action (without undoing)
ISEMPTY → Check if there are actions to undo
On empty stack: POP and PEEK should print "Stack Empty"
We use a singly linked list where new actions are added to the head (top of stack).
Undo (POP) simply removes the head node.
Enter commands and click Run Simulation...
Program output will appear here...