diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json
index 42b50d409c3..35d1c63bd6d 100644
--- a/client/i18n/locales/english/intro.json
+++ b/client/i18n/locales/english/intro.json
@@ -4712,7 +4712,13 @@
"intro": [""]
},
"lab-depth-first-search": {
- "title": "Build a Depth First Search",
+ "title": "Implement the Depth-First Search Algorithm",
+ "intro": [
+ "In this lab, you will implement the Depth-First Search Algorithm."
+ ]
+ },
+ "lab-n-queens-problem": {
+ "title": "",
"intro": [""]
},
"review-graphs-and-trees": {
diff --git a/client/src/pages/learn/full-stack-developer/lab-depth-first-search/index.md b/client/src/pages/learn/full-stack-developer/lab-depth-first-search/index.md
new file mode 100644
index 00000000000..4dbd0e8d0ea
--- /dev/null
+++ b/client/src/pages/learn/full-stack-developer/lab-depth-first-search/index.md
@@ -0,0 +1,9 @@
+---
+title: Introduction to the Implement the Depth-First Search Algorithm
+block: lab-depth-first-search
+superBlock: full-stack-developer
+---
+
+## Introduction to the Implement the Depth-First Search Algorithm
+
+In this lab, you will implement the Depth-First Search Algorithm.
diff --git a/curriculum/challenges/english/blocks/lab-depth-first-search/68d275dd800f404d22a07564.md b/curriculum/challenges/english/blocks/lab-depth-first-search/68d275dd800f404d22a07564.md
new file mode 100644
index 00000000000..75b3db2586e
--- /dev/null
+++ b/curriculum/challenges/english/blocks/lab-depth-first-search/68d275dd800f404d22a07564.md
@@ -0,0 +1,111 @@
+---
+id: 68d275dd800f404d22a07564
+title: Implement the Depth-First Search Algorithm
+challengeType: 27
+dashedName: lab-depth-first-search
+---
+
+# --description--
+
+In this lab, you will implement a graph traversal algorithm called depth-first search.
+
+Whereas the breadth-first search searches incremental edge lengths away from the source node, depth-first search first goes down a path of edges as far as it can.
+
+Once it reaches one end of a path, the search will backtrack to the last node with an un-visited edge path and continue searching.
+
+Unlike breadth-first search, every time a node is visited, it doesn't visit all of its neighbors. Instead, it first visits one of its neighbors and continues down that path until there are no more nodes to be visited on that path.
+
+To implement this algorithm, you'll want to use a stack (an array where the last element added is the first to be removed, following the Last-In-First-Out principle). A stack is helpful in depth-first search algorithms because, as you add neighbors to the stack, you want to visit the most recently added neighbors first and remove them from the stack.
+
+A simple output of this algorithm is a list of nodes which are reachable from a given node. Therefore, you'll also want to keep track of the nodes you visit.
+
+**Objective**: Fulfill the user stories below and get all the tests to pass to complete the lab.
+
+**User Stories:**
+
+1. You should have a function named `dfs`.
+1. The `dfs` function should take two arguments:
+ - An undirected, adjacency matrix.
+ - A node label, which is the numeric value of the node between `0` and `n - 1`, where `n` is the total number of nodes in the graph.
+1. The `dfs` function should implement the depth-first search algorithm to output a list of all nodes reachable from the node passed to it.
+
+# --hints--
+
+You should have a function named `dfs` that takes two arguments.
+
+```js
+({ test: () => runPython(`
+ import inspect
+ assert inspect.isfunction(dfs)
+ sig = inspect.signature(dfs)
+ assert len(sig.parameters) == 2
+`) })
+```
+
+`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1)` should return `[1, 2, 3, 0]`.
+
+```js
+({ test: () => runPython(`
+ assert dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 1) == [1, 2, 3, 0]
+`) })
+```
+
+`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3)` should return `[3, 2, 1, 0]`.
+
+```js
+({ test: () => runPython(`
+ assert dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]], 3) == [3, 2, 1, 0]
+`) })
+```
+
+`dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]], 3)` should return `[3]`.
+
+```js
+({ test: () => runPython(`
+ assert dfs([[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 0]], 3) == [3]
+`) })
+```
+
+`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3)` should return `[3, 2]`.
+
+```js
+({ test: () => runPython(`
+ assert dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 3) == [3, 2]
+`) })
+```
+
+`dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0)` should return `[0, 1]`.
+
+```js
+({ test: () => runPython(`
+ assert dfs([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]], 0) == [0, 1]
+`) })
+```
+
+# --seed--
+
+## --seed-contents--
+
+```py
+
+```
+
+# --solutions--
+
+```py
+def dfs(graph, root):
+ stack = []
+ temp_v = None
+ visited = []
+ temp_v_neighbors = []
+ stack.append(root)
+ while stack:
+ temp_v = stack.pop()
+ if temp_v not in visited:
+ visited.append(temp_v)
+ temp_v_neighbors = graph[temp_v]
+ for n, is_neighbor in enumerate(temp_v_neighbors):
+ if is_neighbor == 1:
+ stack.append(n)
+ return visited
+```
diff --git a/curriculum/structure/blocks/lab-depth-first-search.json b/curriculum/structure/blocks/lab-depth-first-search.json
new file mode 100644
index 00000000000..4b7addffe6f
--- /dev/null
+++ b/curriculum/structure/blocks/lab-depth-first-search.json
@@ -0,0 +1,15 @@
+{
+ "name": "Implement the Depth-First Search Algorithm",
+ "isUpcomingChange": true,
+ "dashedName": "lab-depth-first-search",
+ "helpCategory": "Python",
+ "blockLayout": "link",
+ "challengeOrder": [
+ {
+ "id": "68d275dd800f404d22a07564",
+ "title": "Implement the Depth-First Search Algorithm"
+ }
+ ],
+ "blockType": "lab",
+ "usesMultifileEditor": true
+}
diff --git a/curriculum/structure/superblocks/full-stack-developer.json b/curriculum/structure/superblocks/full-stack-developer.json
index 3d7deabaa6f..89759ae81f5 100644
--- a/curriculum/structure/superblocks/full-stack-developer.json
+++ b/curriculum/structure/superblocks/full-stack-developer.json
@@ -758,6 +758,7 @@
"blocks": [
"lecture-understanding-graphs-and-trees",
"lab-adjacency-list-to-matrix-converter",
+ "lab-depth-first-search",
"review-graphs-and-trees",
"quiz-graphs-and-trees"
]