diff --git a/app/visualizer/searching/binarysearch/page.jsx b/app/visualizer/searching/binarysearch/page.jsx index 1909979..fb67b3f 100644 --- a/app/visualizer/searching/binarysearch/page.jsx +++ b/app/visualizer/searching/binarysearch/page.jsx @@ -56,7 +56,7 @@ export const metadata = { export default function Page() { const paths = [ { name: "Home", href: "/" }, - { name: "Visulaizer", href: "/visualizer" }, + { name: "Visualizer", href: "/visualizer" }, { name: "Binary Search", href: "" }, ]; diff --git a/app/visualizer/searching/linearsearch/page.jsx b/app/visualizer/searching/linearsearch/page.jsx index fe12aef..b40237f 100644 --- a/app/visualizer/searching/linearsearch/page.jsx +++ b/app/visualizer/searching/linearsearch/page.jsx @@ -56,7 +56,7 @@ export const metadata = { export default function Page() { const paths = [ { name: "Home", href: "/" }, - { name: "Visulaizer", href: "/visualizer" }, + { name: "Visualizer", href: "/visualizer" }, { name: "Linear Search", href: "" }, ]; diff --git a/app/visualizer/sorting/bubblesort/page.jsx b/app/visualizer/sorting/bubblesort/page.jsx index c9b6b6f..f5198f3 100644 --- a/app/visualizer/sorting/bubblesort/page.jsx +++ b/app/visualizer/sorting/bubblesort/page.jsx @@ -40,7 +40,7 @@ export const metadata = { openGraph: { images: [ { - url: "/og/bubbleSort.png", + url: "/og/sorting/bubbleSort.png", width: 1200, height: 630, alt: "Bubble Sort Algorithm Visualization", @@ -52,7 +52,7 @@ export const metadata = { export default function Page() { const paths = [ { name: "Home", href: "/" }, - { name: "Visulaizer", href: "/visualizer" }, + { name: "Visualizer", href: "/visualizer" }, { name: "Bubble Sort", href: "" }, ]; diff --git a/app/visualizer/sorting/insertionsort/page.jsx b/app/visualizer/sorting/insertionsort/page.jsx index 9d13021..1a67094 100644 --- a/app/visualizer/sorting/insertionsort/page.jsx +++ b/app/visualizer/sorting/insertionsort/page.jsx @@ -52,7 +52,7 @@ export const metadata = { export default function Page() { const paths = [ { name: "Home", href: "/" }, - { name: "Visulaizer", href: "/visualizer" }, + { name: "Visualizer", href: "/visualizer" }, { name: "Insertion Sort", href: "" }, ]; diff --git a/app/visualizer/sorting/mergesort/content.jsx b/app/visualizer/sorting/mergesort/content.jsx index ef15f62..4e73d82 100644 --- a/app/visualizer/sorting/mergesort/content.jsx +++ b/app/visualizer/sorting/mergesort/content.jsx @@ -43,8 +43,30 @@ const content = () => { ]; return ( -
-
+
+
+
+ +
+
+ + Powered by{" "} + + Hello World + + +
+
+
{/* What is Merge Sort */}

diff --git a/app/visualizer/sorting/selectionsort/content.jsx b/app/visualizer/sorting/selectionsort/content.jsx index 49a3441..ba9f2b4 100644 --- a/app/visualizer/sorting/selectionsort/content.jsx +++ b/app/visualizer/sorting/selectionsort/content.jsx @@ -73,8 +73,30 @@ const content = () => { ]; return ( -
-
+
+
+
+ +
+
+ + Powered by{" "} + + Hello World + + +
+
+
{/* What is Selection Sort */}

@@ -172,9 +194,7 @@ const content = () => { {items.points} - - {items.subpoints} - + {items.subpoints} ))} @@ -184,13 +204,13 @@ const content = () => {

- n*n} - averageCase={(n) => n*n} - worstCase={(n) => n*n} - maxN={25} - /> -
+ n * n} + averageCase={(n) => n * n} + worstCase={(n) => n * n} + maxN={25} + /> +

@@ -250,7 +270,7 @@ const content = () => { {/* Additional Info */}
-
+

{paragraph[3]}

@@ -262,4 +282,4 @@ const content = () => { ); }; -export default content; \ No newline at end of file +export default content; diff --git a/app/visualizer/sorting/selectionsort/page.jsx b/app/visualizer/sorting/selectionsort/page.jsx index 918177b..91959a1 100644 --- a/app/visualizer/sorting/selectionsort/page.jsx +++ b/app/visualizer/sorting/selectionsort/page.jsx @@ -36,7 +36,7 @@ export const metadata = { openGraph: { images: [ { - url: "/og/selectionSort.png", + url: "/og/sorting/selectionSort.png", width: 1200, height: 630, alt: "Selection Sort Algorithm Visualization", @@ -60,7 +60,7 @@ export default function Page() {
-
+
@@ -84,14 +84,14 @@ export default function Page() {
-
+

Test Your Knowledge before moving forward!

-
+
@@ -104,7 +104,7 @@ export default function Page() { />
-
+
{ const [selectedAnswer, setSelectedAnswer] = useState(null); const [score, setScore] = useState(0); const [showResult, setShowResult] = useState(false); - const [setQuizCompleted] = useState(false); + const [quizCompleted, setQuizCompleted] = useState(false); const [answers, setAnswers] = useState(Array(questions.length).fill(null)); - const [showExplanation, setShowExplanation] = useState(false); const [showIntro, setShowIntro] = useState(true); const [showSuccessAnimation, setShowSuccessAnimation] = useState(false); - const [penaltyApplied, setPenaltyApplied] = useState(false); const handleAnswerSelect = (optionIndex) => { - if (selectedAnswer !== null) return; setSelectedAnswer(optionIndex); - const newAnswers = [...answers]; - newAnswers[currentQuestion] = optionIndex; - setAnswers(newAnswers); }; const handleNextQuestion = () => { if (selectedAnswer === null) return; - - if (showExplanation && !penaltyApplied) { - setScore(prevScore => Math.max(0, prevScore - 0.5)); - setPenaltyApplied(true); - } - if (selectedAnswer === questions[currentQuestion].correctAnswer) { - setScore(score + 1); - } - - setShowExplanation(false); - setPenaltyApplied(false); - + const newAnswers = [...answers]; + newAnswers[currentQuestion] = selectedAnswer; + setAnswers(newAnswers); + + const newScore = newAnswers.reduce((acc, ans, idx) => { + return ans === questions[idx].correctAnswer ? acc + 1 : acc; + }, 0); + setScore(newScore); + if (currentQuestion < questions.length - 1) { setCurrentQuestion(currentQuestion + 1); - setSelectedAnswer(null); + setSelectedAnswer(newAnswers[currentQuestion + 1]); } else { setShowSuccessAnimation(true); setTimeout(() => { @@ -132,7 +123,6 @@ const SelectionSortQuiz = () => { }; const handlePreviousQuestion = () => { - setShowExplanation(false); setCurrentQuestion(currentQuestion - 1); setSelectedAnswer(answers[currentQuestion - 1]); }; @@ -144,9 +134,7 @@ const SelectionSortQuiz = () => { setShowResult(false); setQuizCompleted(false); setAnswers(Array(questions.length).fill(null)); - setShowExplanation(false); setShowIntro(true); - setPenaltyApplied(false); }; const calculateWeakAreas = () => { @@ -220,10 +208,6 @@ const SelectionSortQuiz = () => { 0 points for wrong answers -
  • - - -0.5 point penalty for viewing explanations -
  • Earn stars based on your final score (max 5 stars) @@ -325,29 +309,6 @@ const SelectionSortQuiz = () => { ))}
  • - {selectedAnswer !== null && ( -
    - - - {showExplanation && ( - - {questions[currentQuestion].explanation} - - )} - -
    - )}
    diff --git a/public/og/bubbleSort.png b/public/og/bubbleSort.png deleted file mode 100644 index c03ff0e..0000000 Binary files a/public/og/bubbleSort.png and /dev/null differ diff --git a/public/og/selectionSort.png b/public/og/selectionSort.png deleted file mode 100644 index 9710675..0000000 Binary files a/public/og/selectionSort.png and /dev/null differ diff --git a/public/og/sorting/bubbleSort.png b/public/og/sorting/bubbleSort.png new file mode 100644 index 0000000..a2701bf Binary files /dev/null and b/public/og/sorting/bubbleSort.png differ diff --git a/public/og/sorting/selectionSort.png b/public/og/sorting/selectionSort.png new file mode 100644 index 0000000..5246bfb Binary files /dev/null and b/public/og/sorting/selectionSort.png differ