algorithmic-odyssey-explorer / algorithms.html
Ahmedhaj2000's picture
create an app to visualize all algorithms
3447886 verified
Raw History Blame Contribute Delete
5.62 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Algorithm Visualizer | PawnStars</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body class="bg-gray-900 text-white min-h-screen flex flex-col">
<custom-navbar></custom-navbar>
<main class="flex-1 p-4 max-w-7xl mx-auto w-full">
<h1 class="text-3xl font-bold mb-6 flex items-center gap-2">
<i data-feather="cpu"></i> Algorithm Visualizer
</h1>
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
<!-- Controls Panel -->
<div class="lg:col-span-1 space-y-4">
<!-- Algorithm Selection -->
<div class="bg-gray-800 rounded-xl p-4">
<h3 class="text-lg font-bold mb-3 flex items-center gap-2">
<i data-feather="git-branch"></i> Algorithm Type
</h3>
<select id="algorithm-category" class="w-full bg-gray-700 p-2 rounded mb-3">
<option value="sorting">Sorting Algorithms</option>
<option value="searching">Searching Algorithms</option>
<option value="pathfinding">Pathfinding Algorithms</option>
<option value="recursion">Recursive Algorithms</option>
</select>
<select id="algorithm-select" class="w-full bg-gray-700 p-2 rounded">
<option value="bubble-sort">Bubble Sort</option>
<option value="quick-sort">Quick Sort</option>
<option value="merge-sort">Merge Sort</option>
<option value="binary-search">Binary Search</option>
<option value="dijkstra">Dijkstra's Algorithm</option>
<option value="a-star">A* Search</option>
</select>
</div>
<!-- Controls -->
<div class="bg-gray-800 rounded-xl p-4">
<h3 class="text-lg font-bold mb-3 flex items-center gap-2">
<i data-feather="sliders"></i> Controls
</h3>
<div class="space-y-3">
<div>
<label class="block text-sm mb-1">Array Size</label>
<input type="range" id="array-size" min="5" max="50" value="20" class="w-full">
<span id="array-size-value" class="text-sm">20</span>
</div>
<div>
<label class="block text-sm mb-1">Speed</label>
<input type="range" id="speed" min="1" max="10" value="5" class="w-full">
<span id="speed-value" class="text-sm">Medium</span>
</div>
<button id="generate-array" class="w-full bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg transition-colors">
Generate New Array
</button>
</div>
</div>
<!-- Algorithm Info -->
<div class="bg-gray-800 rounded-xl p-4">
<h3 class="text-lg font-bold mb-3 flex items-center gap-2">
<i data-feather="info"></i> Algorithm Information
</h3>
<div id="algorithm-info" class="text-sm space-y-2">
<p><strong>Time Complexity:</strong> <span id="time-complexity">-</span></p>
<p><strong>Space Complexity:</strong> <span id="space-complexity">-</span></p>
<p id="algorithm-description">Select an algorithm to see its description</p>
</div>
</div>
</div>
<!-- Visualization Area -->
<div class="lg:col-span-3 space-y-6">
<div class="bg-gray-800 rounded-xl p-4">
<div class="flex flex-wrap gap-2 mb-4">
<button id="play-btn" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg flex items-center gap-2 transition-colors">
<i data-feather="play"></i> Play
</button>
<button id="pause-btn" class="bg-yellow-600 hover:bg-yellow-700 px-4 py-2 rounded-lg flex items-center gap-2 transition-colors">
<i data-feather="pause"></i> Pause
</button>
<button id="step-btn" class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-lg flex items-center gap-2 transition-colors">
<i data-feather="skip-forward"></i> Step
</button>
<button id="reset-btn" class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded-lg flex items-center gap-2 transition-colors">
<i data-feather="rotate-ccw"></i> Reset
</button>
</div>
<!-- Visualization Canvas -->
<div id="visualization-container" class="bg-gray-700 rounded-lg p-4 min-h-96 flex items-end justify-center gap-1">
<!-- Array bars will be generated here -->
</div>
<!-- Code Display -->
<div class="bg-gray-800 rounded-xl p-4">
<h3 class="text-lg font-bold mb-3 flex items-center gap-2">
<i data-feather="code"></i> Pseudocode
</h3>
<div id="pseudocode" class="bg-gray-900 p-4 rounded font-mono text-sm overflow-x-auto">
// Code will be displayed here
</div>
</div>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script src="algorithms.js"></script>
<script>feather.replace();</script>
</body>
</html>