This project demonstrates the practical application of Stacks and Queues in a text editor environment. It features two modes: an interactive Stack-based editor and a command-processing Queue-based editor.
The interactive mode uses two stacks (undoStack and redoStack) to manage text states.
- Write: Pushes the current state to the undoStack and updates the text.
- Undo: Pops from undoStack, pushes current state to redoStack.
- Redo: Pops from redoStack, pushes current state back to undoStack.
The non-interactive mode processes a string of commands sequentially using a Queue (FIFO).
w <word>: Writes a word.u: Performs a simple undo (removes the last word).s: Shows the current text.- Example Input:
w Data w Structures u w Algorithm s
- Stacks (LIFO): Perfect for Undo/Redo because we always want to access the last action performed.
- Queues (FIFO): Ideal for command processing where commands must be executed in the exact order they were received.
- Clone the repository.
- Open the solution in Visual Studio.
- Choose mode 's' for interactive Stack editor or 'q' for command-based Queue editor.