🌐 Browser History - Stack Implementation

Simulate browser back/forward behavior using a stack!

🎯 Problem: Browser History using Stack

Hi! I'm Teju 👋 We're implementing a simple browser history using a stack.

PUSH → Visit a new page (adds to top)
POP → Go back (removes latest page)
PEEK → Current page
ISEMPTY → Check if no pages visited

Operations: PUSH x | POP | PEEK | ISEMPTY

Output: Results of POP, PEEK, ISEMPTY

Stack behavior: Last In, First Out (LIFO)

⚙️ Stack Operations

Stack is perfect for browser history because you always go back to the most recently visited page.

  • PUSH x: Add page x to the top of history
  • POP: Remove and return the top page (go back)
  • PEEK: Show current (top) page without removing
  • ISEMPTY: Return true if no pages in history

🎮 Interactive Demo

📜 Operation Log

Enter commands and click Run Simulation...

📤 Output

Outputs will appear here...

🗼 Browser History Stack

Empty History