-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathalgorithm-cards.jsx
More file actions
144 lines (139 loc) · 5.72 KB
/
Copy pathalgorithm-cards.jsx
File metadata and controls
144 lines (139 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import Link from 'next/link'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import Image from 'next/image'
const algorithms = [
{
id: 'pathfinder',
title: "Pathfinder",
description: "Visualize graph algorithms like dijkstra, BFS, DFS",
image: '/AlgorithmVisualizer/images/graph.png?height=200&width=300'
},{
id: 'graph',
title: 'Graph Traversal',
description: "Build a graph and watch BFS and DFS explore it node by node",
image: '/AlgorithmVisualizer/images/graph-traversal.png?height=200&width=300'
},{
id: 'shortest-path',
title: 'Shortest Path',
description: "Weighted graphs with Dijkstra and Bellman-Ford, including negative-cycle detection",
image: '/AlgorithmVisualizer/images/shortest-path.png?height=200&width=300'
},{
id: 'mst',
title: 'Minimum Spanning Tree',
description: "Build a weighted graph and watch Kruskal and Prim grow the minimum spanning tree",
image: '/AlgorithmVisualizer/images/mst.png?height=200&width=300'
},{
id: 'connectivity',
title: 'Connectivity',
description: "Build a graph and color its connected components and strongly connected components",
image: '/AlgorithmVisualizer/images/connectivity.png?height=200&width=300'
},{
id: 'network-flow',
title: 'Network Flow',
description: "Compute max flow / min cut with Edmonds-Karp and Ford-Fulkerson on a capacity network",
image: '/AlgorithmVisualizer/images/network-flow.png?height=200&width=300'
},{
id: 'bst',
title: 'Binary Search Trees',
description: "Insert, delete, and search on a plain BST or a Red-Black tree, with animated rotations and recoloring",
image: '/AlgorithmVisualizer/images/bst.png?height=200&width=300'
},{
id: 'binary-heap',
title: 'Binary Heap',
description: "Min-heap: insert, extract-min, build-heap from a list, and heapsort with animated sift up and down",
image: '/AlgorithmVisualizer/images/binary-heap.png?height=200&width=300'
},
{
id: 'recursion-tree',
title: 'Recursion Tree',
description: "The process in which a function calls itself directly or indirectly is called recursion",
image: '/AlgorithmVisualizer/images/recursion.jpg?height=200&width=300'
},
{
id: 'sorting',
title: 'Sorting Algorithm',
description: "Compare different sorting algorithms",
image: '/AlgorithmVisualizer/images/sort.png?height=200&width=300'
},
{
id: 'recursive-sorting',
title: 'Recursive Sorting',
description: "Compare different recursive sorting algorithms",
image: '/AlgorithmVisualizer/images/sort.png?height=200&width=300'
},
{
id: 'n-queen',
title: 'N Queen',
description: "The N queens puzzle is the problem of placing N chess queens on an N*N chessboard so that no two queens threaten each other",
image: '/AlgorithmVisualizer/images/queen.PNG?height=200&width=300'
},
{
id: 'turing-machine',
title: 'Turing Machine',
description: "A Turing machine is a mathematical model of computation that defines an abstract machine that manipulates symbols on a strip of tape according to a table of rules",
image: '/AlgorithmVisualizer/images/turing.jpg?height=200&width=300'
},
{
id: 'prime-numbers',
title: 'Prime Numbers',
description: "Visualize how Seive is better than brute force",
image: '/AlgorithmVisualizer/images/primes.jpg?height=200&width=300'
},
{
id: 'convex-hull',
title: 'Convex Hull',
description: "The convex hull of a set of points is the smallest convex polygon that contains all the points of it",
image: '/AlgorithmVisualizer/images/convex-hull.png?height=200&width=300'
},
{
id: 'binary-search',
title: 'Binary Search',
description: "Binary search is an efficient algorithm for finding an item from a sorted list of item",
image: '/AlgorithmVisualizer/images/binary-search.png?height=200&width=300'
},{
id: 'game-of-life',
title: 'Game of Life',
description: "Visualize the Game of Life cellular automaton",
image: '/AlgorithmVisualizer/images/game-of-life.png?height=200&width=300'
},{
id: 'linked-list',
title: 'Linked List',
description: "Visualize insertion, deletion, search, and reversal on singly and doubly linked lists",
image: '/AlgorithmVisualizer/images/linked-list.png?height=200&width=300'
},
// {
// id: '15-puzzle',
// title: '15 Puzzle',
// description: "The 15-puzzle is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing",
// image: '/AlgorithmVisualizer/images/15puzzle.PNG?height=200&width=300'
// }
]
export function AlgorithmCards() {
return (
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{algorithms.map((algorithm) => (
<Link key={algorithm.id} href={`/${algorithm.id}`} className="block group">
<Card className="overflow-hidden transition-shadow hover:shadow-lg h-full flex flex-col">
<div className="relative h-48">
<Image
src={algorithm.image}
alt={algorithm.title}
layout="fill"
objectFit="cover"
className="transition-transform duration-300 group-hover:scale-105"
/>
</div>
<CardHeader className="flex-grow">
<CardTitle className="text-2xl group-hover:text-primary transition-colors duration-300">
{algorithm.title}
</CardTitle>
</CardHeader>
<CardContent className="flex-grow flex flex-col justify-between">
<p className="text-lg text-muted-foreground">{algorithm.description}</p>
</CardContent>
</Card>
</Link>
))}
</div>
)
}