Skip to content

Commit 9932849

Browse files
committed
change category
1 parent e8a7086 commit 9932849

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/constants/collections.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const TAGS = [
2525
'docker',
2626
'self-hosting',
2727
'algorithms',
28+
'computer-science',
2829
] as const;
2930

3031
/** adjust this later */
@@ -35,10 +36,6 @@ export const CATEGORIES = [
3536
name: 'tutorials',
3637
icon: 'mdi:teach',
3738
},
38-
{
39-
name: 'computer-science',
40-
icon: 'mdi:cpu-64-bit',
41-
},
4239
{
4340
name: 'homelab',
4441
icon: 'mdi:flask-empty-outline',

src/content/post/2025/07-31-maze-solver/index.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ heroImage: '../../../../content/post/2025/07-31-maze-solver/_images/terminal-her
77
heroAlt: Maze solver terminal
88
tags:
99
- algorithms
10-
category: computer-science
10+
- computer-science
11+
category: showcases
1112
toc: true
1213
draft: false
1314
---
@@ -261,19 +262,19 @@ export class MazeSolverBFS extends MazeSolver {
261262
}
262263
```
263264

264-
#### BFS
265+
### BFS
265266

266267
Since BFS uses a queue, it respects this structure and attempts to change direction in every iteration of the outer loop. Without obstacles and boundaries, this causes the algorithm to thoroughly inspect nodes closer to the starting node before moving further away. That's why BFS can be inefficient for large trees and graphs where the end node is very distant from the starting node.
267268

268-
#### DFS
269+
### DFS
269270

270271
In contrast, DFS also respects the initial order in the directions array but prioritizes the earlier elements. So, in the example above, it will always attempt to apply the `up` direction first before exploring other directions. Without obstacles and boundaries, this causes the algorithm to inspect distant nodes in a straight line. DFS can be efficient for finding a distant end node but can also be very inefficient for finding a nearby node if it happens to be in a different direction.
271272

272273
### Weighted graphs
273274

274275
Not all graphs have edges with uniform weights. In such cases, we must use algorithms that are aware of weights (the cost between two nodes), such as Dijkstra and A*.
275276

276-
#### Dijkstra
277+
### Dijkstra
277278

278279
Dijkstra's algorithm is aware of the cost between two nodes (edge weight) and takes it into account when selecting the next node. It uses a priority queue to keep track of the cost history.
279280

@@ -293,7 +294,7 @@ if( ... && !costMap.has(coordKey) || nextCost < costMap.get(coordKey)!)
293294

294295
Dijkstra keeps a history of the cost of the current path and when selecting the next node chooses the node that adds the minimal cost. If there are cycles it may access the same node from multiple paths and will choose the one with the minimal weight (shortest path). In graphs with constant edge weights it reduces to BFS. This can be observed in the screenshot above, where both BFS and Dijkstra take an equal number of steps because the maze has uniform weights of 1 and Infinity.
295296

296-
#### A\*
297+
### A\*
297298

298299
A\* is the same as Dijkstra but besides keeping the history, it uses a heuristic function to predict the future - the direction in which the end node could be.
299300

0 commit comments

Comments
 (0)