Skip to content

Commit f5028a6

Browse files
committed
Use documentation comments.
This was suggested by thbwd: "Shouldn’t these be documentation comments? https://www.emojicode.org/ docs/reference/documentation.html" (https://github.com/algorithm-archivists/algorithm-archive/pull/ 471#discussion_r223291281)
1 parent 6139820 commit f5028a6

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

contents/tree_traversal/code/emojicode/tree_traversal.emojic

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
↩️ children
2525
🍉
2626

27-
💭 Depth-First Search Recursive pre-order
27+
📗 Depth-First Search Recursive pre-order 📗
2828
❗️ 🌀 🍇
2929
😀 🔡 id 10❗️❗️
3030

@@ -33,7 +33,7 @@
3333
🍉
3434
🍉
3535

36-
💭 Depth-First Search Recursive post-order
36+
📗 Depth-First Search Recursive post-order 📗
3737
❗️ 🍥 🍇
3838
🔂 child children 🍇
3939
🍥 child❗️
@@ -42,8 +42,10 @@
4242
😀 🔡 id 10❗️❗️
4343
🍉
4444

45-
💭 Depth-First Search Recursive Inorder Binary
46-
💭 This assumes only 2 children.
45+
📗
46+
Depth-First Search Recursive Inorder Binary
47+
This assumes only 2 children.
48+
📗
4749
❗️ 🍭 🍇
4850
↪️ 🐔 children❗️ ▶️ 2 🍇
4951
↩️↩️
@@ -59,7 +61,7 @@
5961
🍉
6062
🍉
6163

62-
💭 Depth-First Search Stack
64+
📗 Depth-First Search Stack 📗
6365
❗️ 🥞 🍇
6466
🍨 🐕 🍆 ➡️ stack
6567

@@ -76,7 +78,7 @@
7678
🍉
7779
🍉
7880

79-
💭 Breadth-First Search Queue
81+
📗 Breadth-First Search Queue 📗
8082
❗️ 🏢 🍇
8183
🍨 🐕 🍆 ➡️ queue
8284

contents/tree_traversal/tree_traversal.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ In this case, the first node visited is at the bottom of the tree and moves up t
160160
{% sample lang="go" %}
161161
[import:24-38, lang:"golang"](code/golang/treetraversal.go)
162162
{% sample lang="emojic" %}
163-
[import:45-60, lang:"emojicode"](code/emojicode/tree_traversal.emojic)
163+
[import:45-62, lang:"emojicode"](code/emojicode/tree_traversal.emojic)
164164
{% endmethod %}
165165

166166
<p>
@@ -211,7 +211,7 @@ In code, it looks like this:
211211
{% sample lang="go" %}
212212
[import:40-49, lang:"golang"](code/golang/treetraversal.go)
213213
{% sample lang="emojic" %}
214-
[import:62-77, lang:"emojicode"](code/emojicode/tree_traversal.emojic)
214+
[import:64-79, lang:"emojicode"](code/emojicode/tree_traversal.emojic)
215215
{% endmethod %}
216216

217217
All this said, there are a few details about DFS that might not be idea, depending on the situation. For example, if we use DFS on an incredibly long tree, we will spend a lot of time going further and further down a single branch without searching the rest of the data structure. In addition, it is not the natural way humans would order a tree if asked to number all the nodes from top to bottom. I would argue a more natural traversal order would look something like this:
@@ -254,7 +254,7 @@ And this is exactly what Breadth-First Search (BFS) does! On top of that, it can
254254
{% sample lang="go" %}
255255
[import:51-60, lang:"golang"](code/golang/treetraversal.go)
256256
{% sample lang="emojic" %}
257-
[import:79-94, lang:"emojicode"](code/emojicode/tree_traversal.emojic)
257+
[import:81-96, lang:"emojicode"](code/emojicode/tree_traversal.emojic)
258258
{% endmethod %}
259259

260260
## Example Code

0 commit comments

Comments
 (0)