Skip to content

Commit 35670d2

Browse files
authored
Feat : added new layouts and dsa challenge to whole sorting section
Merge pull request #22 from Sohan-Rout/main1
2 parents 286460d + aaa38d3 commit 35670d2

File tree

10 files changed

+765
-710
lines changed

10 files changed

+765
-710
lines changed

app/visualizer/sorting/mergesort/animation.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const MergeSortVisualizer = () => {
229229

230230
<div className="max-w-4xl mx-auto">
231231
{/* Controls */}
232-
<div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md mb-8 border border-gray-200 dark:border-gray-700">
232+
<div className="bg-white dark:bg-neutral-950 p-4 sm:p-6 rounded-lg shadow-md mb-6 md:mb-8 border border-gray-200 dark:border-gray-700">
233233
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
234234
<div>
235235
<ArrayGenerator
@@ -254,13 +254,13 @@ const MergeSortVisualizer = () => {
254254
<button
255255
onClick={mergeSort}
256256
disabled={!array.length || sorting || sorted}
257-
className="w-full bg-none border border-black dark:border-white text-black dark:text-white px-4 py-2 rounded disabled:opacity-50 disabled:text-blue-500 disabled:border-blue-500 disabled:dark:border-blue-500 disabled:dark:text-blue-500"
257+
className="w-full disabled:opacity-75 bg-none bg-green-500 px-4 py-2 rounded shadow-sm transition-all duration-300 text-sm sm:text-base text-black"
258258
>
259259
{sorting ? "Sorting..." : "Start Merge Sort"}
260260
</button>
261261
<button
262262
onClick={reset}
263-
className="w-full bg-none border border-black dark:border-white text-balck dark:text-white px-4 py-2 rounded"
263+
className="w-full bg-none text-white bg-red-500 px-4 py-2 rounded transition-colors text-sm sm:text-base"
264264
>
265265
Reset All
266266
</button>
@@ -285,19 +285,19 @@ const MergeSortVisualizer = () => {
285285

286286
{/* Stats */}
287287
<div className="grid grid-cols-2 gap-4 text-sm">
288-
<div className="bg-gray-100 dark:bg-gray-700 p-3 rounded">
288+
<div className="bg-gray-100 dark:bg-neutral-900 p-3 rounded">
289289
<div className="font-medium">Comparisons:</div>
290290
<div className="text-2xl">{comparisons}</div>
291291
</div>
292-
<div className="bg-gray-100 dark:bg-gray-700 p-3 rounded">
292+
<div className="bg-gray-100 dark:bg-neutral-900 p-3 rounded">
293293
<div className="font-medium">Merges:</div>
294294
<div className="text-2xl">{swaps}</div>
295295
</div>
296296
</div>
297297
</div>
298298

299299
{/* Main Array Visualization */}
300-
<div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-200 dark:border-gray-700">
300+
<div className="bg-white dark:bg-neutral-950 p-6 rounded-lg shadow-md border border-gray-200 dark:border-gray-700">
301301
<h2 className="text-xl font-semibold mb-4">Main Array</h2>
302302
{array.length > 0 ? (
303303
<div className="flex flex-wrap gap-4 justify-center">

app/visualizer/sorting/mergesort/codeBlock.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ int main() {
312312
initial={{ opacity: 0, y: 20 }}
313313
animate={{ opacity: 1, y: 0 }}
314314
transition={{ duration: 0.3 }}
315-
className="bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 transition-colors duration-300"
315+
className="bg-white dark:bg-neutral-950 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 transition-colors duration-300"
316316
>
317317
{/* Header */}
318-
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center p-4 bg-gray-50 dark:bg-gray-700/50 border-b border-gray-200 dark:border-gray-700">
318+
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center p-4 bg-gray-50 dark:bg-neutral-950 border-b border-gray-200 dark:border-gray-700">
319319
<div className="flex items-center mb-2 sm:mb-0">
320320
<FaCode className="text-blue-500 mr-2 text-lg" />
321321
<h3 className="text-lg font-semibold text-gray-800 dark:text-white">

app/visualizer/sorting/mergesort/content.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ const content = () => {
157157
</p>
158158
<div className="mt-8">
159159
<ComplexityGraph
160-
bestCase={(n) => n * Math.log(n)}
161-
averageCase={(n) => n * Math.log(n)}
162-
worstCase={(n) => n * Math.log(n)}
160+
bestCase={(n) => n * Math.log2(n)}
161+
averageCase={(n) => n * Math.log2(n)}
162+
worstCase={(n) => n * Math.log2(n)}
163163
maxN={25}
164164
/>
165165
</div>

app/visualizer/sorting/mergesort/quiz.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,22 @@ const MergeSortQuiz = () => {
180180
};
181181

182182
return (
183-
<section className="max-w-2xl mx-auto shadow-lg rounded-xl bg-white dark:bg-gray-800 mt-8 mb-8 p-6 border border-gray-200 dark:border-gray-700">
183+
<section className="max-w-4xl mx-auto shadow-lg rounded-xl bg-white dark:bg-neutral-950 mt-8 mb-8 p-6 border border-gray-200 dark:border-gray-700">
184184
{showIntro ? (
185185
<motion.div
186186
initial={{ opacity: 0, y: 20 }}
187187
animate={{ opacity: 1, y: 0 }}
188188
className="text-center"
189189
>
190190
<div className="flex justify-center mb-6">
191-
<div className="bg-blue-100 dark:bg-blue-900/30 p-4 rounded-full">
191+
<div className="bg-blue-100 dark:bg-neutral-900 p-4 rounded-full">
192192
<FaAward className="text-4xl text-blue-500 dark:text-blue-500" />
193193
</div>
194194
</div>
195195
<h2 className="text-2xl font-bold mb-4 text-black dark:text-gray-100">
196196
Merge Sort Quiz Challenge
197197
</h2>
198-
<div className="bg-white dark:bg-gray-700 p-4 rounded-lg mb-6 text-left shadow-inner">
198+
<div className="bg-white dark:bg-neutral-900 p-4 rounded-lg mb-6 text-left shadow-inner">
199199
<h3 className="font-bold mb-2 flex items-center text-blue-600 dark:text-blue-400">
200200
<FaInfoCircle className="mr-2" /> How it works:
201201
</h3>

0 commit comments

Comments
 (0)