diff --git a/app/visualizer/sorting/insertionsort/page.jsx b/app/visualizer/sorting/insertionsort/page.jsx
index 1a67094..c805310 100644
--- a/app/visualizer/sorting/insertionsort/page.jsx
+++ b/app/visualizer/sorting/insertionsort/page.jsx
@@ -124,4 +124,4 @@ export default function Page() {
>
);
-}
+}
\ No newline at end of file
diff --git a/app/visualizer/sorting/insertionsort/quiz.jsx b/app/visualizer/sorting/insertionsort/quiz.jsx
index 19e4959..642ce01 100644
--- a/app/visualizer/sorting/insertionsort/quiz.jsx
+++ b/app/visualizer/sorting/insertionsort/quiz.jsx
@@ -181,7 +181,7 @@ const InsertionSortQuiz = () => {
};
return (
-
+
{showIntro ? (
{
className="text-center"
>
-
+
Insertion Sort Quiz Challenge
-
+
How it works:
diff --git a/app/visualizer/sorting/mergesort/animation.jsx b/app/visualizer/sorting/mergesort/animation.jsx
index 985f6a6..bf20356 100644
--- a/app/visualizer/sorting/mergesort/animation.jsx
+++ b/app/visualizer/sorting/mergesort/animation.jsx
@@ -1,15 +1,8 @@
"use client";
import React, { useState, useRef, useEffect } from "react";
import { gsap } from "gsap";
-import Footer from "@/app/components/footer";
-import Content from "@/app/visualizer/sorting/mergesort/content";
import ArrayGenerator from "@/app/components/ui/randomArray";
import CustomArrayInput from "@/app/components/ui/customArrayInput";
-import ExploreOther from "@/app/components/ui/exploreOther";
-import CodeBlock from "@/app/visualizer/sorting/mergesort/codeBlock";
-import Quiz from "@/app/visualizer/sorting/mergesort/quiz";
-import GoBackButton from "@/app/components/ui/goback";
-import BackToTop from "@/app/components/ui/backtotop";
const MergeSortVisualizer = () => {
const [array, setArray] = useState([]);
@@ -228,20 +221,7 @@ const MergeSortVisualizer = () => {
return (
-
-
-
- { /* go back block here */}
-
-
-
-
- { /* main logic here */}
-
- Merge Sort
-
-
-
+
Visualize the divide-and-conquer approach of Merge Sort with recursive
splitting and merging.
@@ -364,57 +344,8 @@ const MergeSortVisualizer = () => {
)}
-
- {/* Enhanced Recursion Tree */}
-
- {/* Algorithm Explanation with Visual Guide */}
-
-
Merge Sort Process
-
-
-
Steps:
-
-
- Divide array into halves recursively until single elements
-
-
Merge adjacent subarrays in sorted order
-
Continue merging until whole array is sorted
-
-
-
-
-
- { /* quiz block here */}
-
- Test Your Knowledge before moving forward!
-
-
-
-
-
-
-
-
-
-
-
);
};
diff --git a/app/visualizer/sorting/mergesort/content.jsx b/app/visualizer/sorting/mergesort/content.jsx
index 4e73d82..d6ff335 100644
--- a/app/visualizer/sorting/mergesort/content.jsx
+++ b/app/visualizer/sorting/mergesort/content.jsx
@@ -1,3 +1,6 @@
+"use client";
+import ComplexityGraph from "@/app/components/ui/graph";
+
const content = () => {
const paragraph = [
`Merge Sort is an efficient, stable, comparison-based sorting algorithm that follows the divide-and-conquer approach. It works by recursively dividing the unsorted list into sublists until each sublist contains a single element, then repeatedly merges these sublists to produce new sorted sublists until there is only one sorted list remaining.`,
@@ -7,42 +10,59 @@ const content = () => {
];
const algorithm = [
- { points : "Divide:",
- subpoints : [
+ {
+ points: "Divide:",
+ subpoints: [
"Find the middle point to divide the array into two halves",
"Recursively call merge sort on the first half",
"Recursively call merge sort on the second half",
],
},
- { points : "Merge:",
- subpoints : [
+ {
+ points: "Merge:",
+ subpoints: [
"Create temporary arrays for both halves",
"Compare elements from each half and merge them in order",
"Copy any remaining elements from either half",
],
- },
+ },
];
const timeComplexity = [
- { points : "Best Case: O(n log n) (already sorted, but still needs all comparisons)" },
- { points : "Average Case: O(n log n)" },
- { points : "Worst Case: O(n log n) (consistent performance)" },
+ {
+ points:
+ "Best Case: O(n log n) (already sorted, but still needs all comparisons)",
+ },
+ { points: "Average Case: O(n log n)" },
+ { points: "Worst Case: O(n log n) (consistent performance)" },
];
const advantages = [
- { points : "Stable sorting (maintains relative order of equal elements)" },
- { points : "Excellent for large datasets (consistent O(n log n) performance)" },
- { points : "Well-suited for external sorting (sorting data too large for RAM)" },
- { points : "Easily parallelizable (divide steps can be done concurrently)" },
+ { points: "Stable sorting (maintains relative order of equal elements)" },
+ {
+ points:
+ "Excellent for large datasets (consistent O(n log n) performance)",
+ },
+ {
+ points:
+ "Well-suited for external sorting (sorting data too large for RAM)",
+ },
+ { points: "Easily parallelizable (divide steps can be done concurrently)" },
];
const disadvantages = [
- { points : "Requires O(n) additional space (not in-place)" },
- { points : "Slower than O(n²) algorithms for very small datasets due to recursion overhead" },
- { points : "Not as cache-efficient as some other algorithms (e.g., QuickSort)" },
+ { points: "Requires O(n) additional space (not in-place)" },
+ {
+ points:
+ "Slower than O(n²) algorithms for very small datasets due to recursion overhead",
+ },
+ {
+ points:
+ "Not as cache-efficient as some other algorithms (e.g., QuickSort)",
+ },
];
- return (
+ return (