diff --git a/app/visualizer/stack/polish/postfix/content.jsx b/app/visualizer/stack/polish/postfix/content.jsx
index 73eefc6..93fb32e 100644
--- a/app/visualizer/stack/polish/postfix/content.jsx
+++ b/app/visualizer/stack/polish/postfix/content.jsx
@@ -1,4 +1,28 @@
-const InfixToPostfixContent = () => {
+"use client";
+import { useEffect, useState } from "react";
+
+const content = () => {
+ const [theme, setTheme] = useState("light");
+ const [mounted, setMounted] = useState(false);
+
+ useEffect(() => {
+ const updateTheme = () => {
+ const savedTheme = localStorage.getItem("theme") || "light";
+ setTheme(savedTheme);
+ };
+
+ updateTheme();
+ setMounted(true);
+
+ window.addEventListener("storage", updateTheme);
+ window.addEventListener("themeChange", updateTheme);
+
+ return () => {
+ window.removeEventListener("storage", updateTheme);
+ window.removeEventListener("themeChange", updateTheme);
+ };
+ }, []);
+
const paragraph = [
`Postfix notation (also called Reverse Polish Notation) is a way of writing expressions where the operator comes after the operands.`,
`For example, the infix expression 3 + 4 becomes 3 4 + in postfix. It removes the need for parentheses by making operator precedence explicit through position.`,
@@ -26,8 +50,37 @@ const InfixToPostfixContent = () => {
];
return (
-
-
+
+
+
+ {mounted && (
+
+ )}
+
+
+
+
{/* What is Postfix Notation? */}
@@ -150,8 +203,37 @@ const InfixToPostfixContent = () => {
+
+ {/* Mobile iframe at bottom */}
+
+ {mounted && (
+
+ )}
+
+
);
};
- export default InfixToPostfixContent;
\ No newline at end of file
+ export default content;
\ No newline at end of file
diff --git a/app/visualizer/stack/polish/postfix/page.jsx b/app/visualizer/stack/polish/postfix/page.jsx
index 1f5dc0c..fc5b856 100644
--- a/app/visualizer/stack/polish/postfix/page.jsx
+++ b/app/visualizer/stack/polish/postfix/page.jsx
@@ -1,32 +1,117 @@
import Animation from "@/app/visualizer/stack/polish/postfix/animation";
import Navbar from "@/app/components/navbarinner";
+import Breadcrumbs from "@/app/components/ui/Breadcrumbs";
+import ArticleActions from "@/app/components/ui/ArticleActions";
+import Content from "@/app/visualizer/stack/polish/postfix/content";
+import Quiz from "@/app/visualizer/stack/polish/postfix/quiz";
+import Code from "@/app/visualizer/stack/polish/postfix/codeBlock";
+import ModuleCard from "@/app/components/ui/ModuleCard";
+import { MODULE_MAPS } from "@/lib/modulesMap";
+import Footer from "@/app/components/footer";
+import ExploreOther from "@/app/components/ui/exploreOther";
+import BackToTopButton from "@/app/components/ui/backtotop";
export const metadata = {
- title: 'Postfix Notation using Stack | Learn Postfix Evaluation in DSA with Code in JS, C, Python, Java',
- description: 'Visualize how Postfix expressions are evaluated using a Stack through interactive animations and code examples in JavaScript, C, Python, and Java. Perfect for DSA beginners and technical interview preparation.',
- keywords: [
- 'Postfix Notation',
- 'Postfix Evaluation Stack',
- 'Stack DSA',
- 'Postfix Expression',
- 'DSA Postfix',
- 'Evaluate Postfix using Stack',
- 'Learn Postfix Notation',
- 'Postfix Evaluation in JavaScript',
- 'Postfix Evaluation in C',
- 'Postfix Evaluation in Python',
- 'Postfix Evaluation in Java',
- 'Stack Code Examples',
- 'DSA Expression Evaluation',
+ title:
+ "Postfix Notation using Stack | Learn Postfix Evaluation in DSA with Code in JS, C, Python, Java",
+ description:
+ "Visualize how Postfix expressions are evaluated using a Stack through interactive animations and code examples in JavaScript, C, Python, and Java. Perfect for DSA beginners and technical interview preparation.",
+ keywords: [
+ "Postfix Notation",
+ "Postfix Evaluation Stack",
+ "Stack DSA",
+ "Postfix Expression",
+ "DSA Postfix",
+ "Evaluate Postfix using Stack",
+ "Learn Postfix Notation",
+ "Postfix Evaluation in JavaScript",
+ "Postfix Evaluation in C",
+ "Postfix Evaluation in Python",
+ "Postfix Evaluation in Java",
+ "Stack Code Examples",
+ "DSA Expression Evaluation",
+ ],
+ robots: "index, follow",
+ openGraph: {
+ images: [
+ {
+ url: "/og/stack/postfix.png",
+ width: 1200,
+ height: 630,
+ alt: "Stack infix to postfix",
+ },
],
- robots: "index, follow",
- };
-
-export default function Page (){
- return(
- <>
-
-
- >
- );
-};
\ No newline at end of file
+ },
+};
+
+export default function Page() {
+ const paths = [
+ { name: "Home", href: "/" },
+ { name: "Visualizer", href: "/visualizer" },
+ { name: "Stack : Infix to postfix", href: "" },
+ ];
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Infix to Postfix
+
+
+
+
+
+
+
+
+
+
+
+ Test Your Knowledge before moving forward!
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/app/visualizer/stack/polish/postfix/quiz.jsx b/app/visualizer/stack/polish/postfix/quiz.jsx
index 93f8bf5..28c4c69 100644
--- a/app/visualizer/stack/polish/postfix/quiz.jsx
+++ b/app/visualizer/stack/polish/postfix/quiz.jsx
@@ -1,3 +1,4 @@
+"use client";
import React, { useState } from 'react';
import { FaCheck, FaTimes, FaArrowRight, FaArrowLeft, FaInfoCircle, FaRedo, FaTrophy, FaStar, FaAward } from 'react-icons/fa';
import { motion, AnimatePresence } from 'framer-motion';
@@ -169,30 +170,39 @@ const StackQuiz = () => {
const calculateWeakAreas = () => {
const weakAreas = [];
if (answers[0] !== questions[0].correctAnswer) {
- weakAreas.push("understanding the basic principle of Selection Sort");
+ weakAreas.push("understanding the key characteristic of postfix notation");
}
if (answers[1] !== questions[1].correctAnswer) {
- weakAreas.push("time complexity analysis");
+ weakAreas.push("converting infix to postfix with parentheses");
}
if (answers[2] !== questions[2].correctAnswer) {
- weakAreas.push("counting swaps in Selection Sort");
+ weakAreas.push("operator precedence in conversion");
}
if (answers[3] !== questions[3].correctAnswer) {
- weakAreas.push("comparison with other simple sorts");
+ weakAreas.push("right-associativity of exponentiation");
}
if (answers[4] !== questions[4].correctAnswer) {
- weakAreas.push("space complexity");
+ weakAreas.push("using a stack for conversion");
}
if (answers[5] !== questions[5].correctAnswer) {
- weakAreas.push("stability characteristics");
+ weakAreas.push("handling mixed operator precedence");
}
if (answers[6] !== questions[6].correctAnswer) {
- weakAreas.push("practical applications");
+ weakAreas.push("handling closing parentheses");
}
-
- return weakAreas.length > 0
+ if (answers[7] !== questions[7].correctAnswer) {
+ weakAreas.push("evaluating precedence in arithmetic expressions");
+ }
+ if (answers[8] !== questions[8].correctAnswer) {
+ weakAreas.push("why postfix does not need parentheses");
+ }
+ if (answers[9] !== questions[9].correctAnswer) {
+ weakAreas.push("evaluating complex postfix expressions");
+ }
+
+ return weakAreas.length > 0
? `Focus on improving: ${weakAreas.join(', ')}. Review the corresponding sections above.`
- : "Perfect! You've mastered all Selection Sort concepts!";
+ : "Perfect! You've mastered all Postfix and Stack concepts!";
};
const startQuiz = () => {
@@ -209,7 +219,7 @@ const StackQuiz = () => {
};
return (
-
+
{showIntro ? (
{
className="text-center"
>
-
Stack Quiz Challenge
-
+
How it works:
@@ -430,7 +440,7 @@ const StackQuiz = () => {
-
+
Performance Analysis
diff --git a/lib/modulesMap.js b/lib/modulesMap.js
index f2eb3a7..5cfc5eb 100644
--- a/lib/modulesMap.js
+++ b/lib/modulesMap.js
@@ -10,4 +10,5 @@ export const MODULE_MAPS = {
peek : "fd95f8af-fb22-413f-9080-ebb558b53e70",
isEmpty : "05ecbddd-e3d4-4fa1-aa45-71accac97d79",
isFull : "54301ec9-0586-48f0-a6db-18a41adeb856",
+ postfix : "ca3daf8d-23f8-4ade-adfd-4bd0a88d3da2",
}
\ No newline at end of file