Skip to content

Commit a371d0d

Browse files
committed
Adding comments to the languages without an implementation.
1 parent df3298c commit a371d0d

File tree

2 files changed

+47
-33
lines changed

2 files changed

+47
-33
lines changed

chapters/tree_traversal/code/julia/Tree.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using DataStructures
22

3-
# This has not been implemented in your chosen language, so here's Julia code
43
struct Node
54
children::Vector{Node}
65
ID::Int64
76
Node(ID::Int64) = new(Vector{Node}(), ID)
87
end
98

10-
# This has not been implemented in your chosen language, so here's Julia code
119
function DFS_recursive(n::Node)
1210
# Here we are doing something...
1311
println(n.ID)
@@ -17,7 +15,6 @@ function DFS_recursive(n::Node)
1715
end
1816
end
1917

20-
# This has not been implemented in your chosen language, so here's Julia code
2118
function DFS_recursive_postorder(n::Node)
2219

2320
for child in n.children
@@ -28,7 +25,6 @@ function DFS_recursive_postorder(n::Node)
2825
println(n.ID)
2926
end
3027

31-
# This has not been implemented in your chosen language, so here's Julia code
3228
# This assumes only 2 children
3329
function DFS_recursive_inorder_btree(n::Node)
3430

@@ -46,7 +42,6 @@ function DFS_recursive_inorder_btree(n::Node)
4642
end
4743
end
4844

49-
# This has not been implemented in your chosen language, so here's Julia code
5045
function DFS_stack(n::Node)
5146
s = Stack(Node)
5247
push!(s, n)
@@ -60,7 +55,6 @@ function DFS_stack(n::Node)
6055
end
6156
end
6257

63-
# This has not been implemented in your chosen language, so here's Julia code
6458
function BFS_queue(n::Node)
6559
q = Queue(Node)
6660
enqueue!(q, n)
@@ -102,7 +96,6 @@ function main()
10296

10397
println("Using queue-based BFS:")
10498
BFS_queue(root);
105-
10699
end
107100

108101
main()

chapters/tree_traversal/tree_traversal.md

Lines changed: 47 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ Trees are naturally recursive data structures, and because of this, we cannot ac
44

55
{% method %}
66
{% sample lang="jl" %}
7-
[import:4-8, lang:"julia"](code/julia/Tree.jl)
7+
This is some text
8+
[import:3-7, lang:"julia"](code/julia/Tree.jl)
89
{% sample lang="cpp" %}
910
[import:15-18, lang:"c_cpp"](code/c++/tree_example.cpp)
1011
{% sample lang="cs" %}
1112
[import:11-15, lang:"csharp"](code/cs/TreeMdAdditional/TreeMdAdditional.cs)
1213
{% sample lang="c" %}
1314
[import:5-10, lang:"c_cpp"](code/c/tree_traversal.c)
1415
{% sample lang="js" %}
15-
[import:3-8, lang:"julia"](code/julia/Tree.jl)
16+
This has not been implemented in your chosen language, so here is the Julia code
17+
[import:3-7, lang:"julia"](code/julia/Tree.jl)
1618
{% sample lang="py2" %}
1719
[import:1-5, lang:"python"](code/python2/Tree_example.py)
1820
{% sample lang="py3" %}
1921
[import:5-10, lang:"python"](code/python3/Tree_example.py)
2022
{% sample lang="scratch" %}
21-
[import:3-8, lang:"julia"](code/julia/Tree.jl)
23+
This has not been implemented in your chosen language, so here is the Julia code
24+
[import:3-7, lang:"julia"](code/julia/Tree.jl)
2225
{% sample lang="rs"%}
2326
[import:4-7, lang:"rust"](code/rust/tree.rs)
2427
{% endmethod %}
@@ -27,7 +30,7 @@ Because of this, the most straightforward way to traverse the tree might be recu
2730

2831
{% method %}
2932
{% sample lang="jl" %}
30-
[import:11-18, lang:"julia"](code/julia/Tree.jl)
33+
[import:9-16, lang:"julia"](code/julia/Tree.jl)
3134
{% sample lang="cpp" %}
3235
[import:20-27, lang:"c_cpp"](code/c++/tree_example.cpp)
3336
{% sample lang="cs" %}
@@ -39,9 +42,11 @@ Because of this, the most straightforward way to traverse the tree might be recu
3942
{% sample lang="py2" %}
4043
[import:8-16, lang:"python"](code/python2/Tree_example.py)
4144
{% sample lang="py3" %}
42-
[import:10-18, lang:"julia"](code/julia/Tree.jl)
45+
This has not been implemented in your chosen language, so here is the Julia code
46+
[import:9-16, lang:"julia"](code/julia/Tree.jl)
4347
{% sample lang="scratch" %}
44-
[import:10-18, lang:"julia"](code/julia/Tree.jl)
48+
This has not been implemented in your chosen language, so here is the Julia code
49+
[import:9-16, lang:"julia"](code/julia/Tree.jl)
4550
{% sample lang="rs"%}
4651
[import:9-15 lang:"rust"](code/rust/tree.rs)
4752
{% endmethod %}
@@ -59,23 +64,30 @@ Now, in this case the first element searched through is still the root of the tr
5964

6065
{% method %}
6166
{% sample lang="jl" %}
62-
[import:21-29, lang:"julia"](code/julia/Tree.jl)
67+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
6368
{% sample lang="cpp" %}
64-
[import:20-29, lang:"julia"](code/julia/Tree.jl)
69+
This has not been implemented in your chosen language, so here is the Julia code
70+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
6571
{% sample lang="cs" %}
6672
[import:75-84, lang:"csharp"](code/cs/TreeMdAdditional/TreeMdAdditional.cs)
6773
{% sample lang="c" %}
68-
[import:20-29, lang:"julia"](code/julia/Tree.jl)
74+
This has not been implemented in your chosen language, so here is the Julia code
75+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
6976
{% sample lang="js" %}
70-
[import:20-29, lang:"julia"](code/julia/Tree.jl)
77+
This has not been implemented in your chosen language, so here is the Julia code
78+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
7179
{% sample lang="py2" %}
72-
[import:20-29, lang:"julia"](code/julia/Tree.jl)
80+
This has not been implemented in your chosen language, so here is the Julia code
81+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
7382
{% sample lang="py3" %}
74-
[import:20-29, lang:"julia"](code/julia/Tree.jl)
83+
This has not been implemented in your chosen language, so here is the Julia code
84+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
7585
{% sample lang="scratch" %}
76-
[import:20-29, lang:"julia"](code/julia/Tree.jl)
86+
This has not been implemented in your chosen language, so here is the Julia code
87+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
7788
{% sample lang="rs"%}
78-
[import:20-29, lang:"julia"](code/julia/Tree.jl)
89+
This has not been implemented in your chosen language, so here is the Julia code
90+
[import:18-26, lang:"julia"](code/julia/Tree.jl)
7991
{% endmethod %}
8092

8193
<p align="center">
@@ -86,23 +98,30 @@ In this case, the first node visited is at the bottom of the tree and moves up t
8698

8799
{% method %}
88100
{% sample lang="jl" %}
89-
[import:32-47, lang:"julia"](code/julia/Tree.jl)
101+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
90102
{% sample lang="cpp" %}
91-
[import:31-47, lang:"julia"](code/julia/Tree.jl)
103+
This has not been implemented in your chosen language, so here is the Julia code
104+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
92105
{% sample lang="cs" %}
93106
[import:86-104, lang:"csharp"](code/cs/TreeMdAdditional/TreeMdAdditional.cs)
94107
{% sample lang="c" %}
95-
[import:31-47, lang:"julia"](code/julia/Tree.jl)
108+
This has not been implemented in your chosen language, so here is the Julia code
109+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
96110
{% sample lang="js" %}
97-
[import:31-47, lang:"julia"](code/julia/Tree.jl)
111+
This has not been implemented in your chosen language, so here is the Julia code
112+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
98113
{% sample lang="py2" %}
99-
[import:31-47, lang:"julia"](code/julia/Tree.jl)
114+
This has not been implemented in your chosen language, so here is the Julia code
115+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
100116
{% sample lang="py3" %}
101-
[import:31-47, lang:"julia"](code/julia/Tree.jl)
117+
This has not been implemented in your chosen language, so here is the Julia code
118+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
102119
{% sample lang="scratch" %}
103-
[import:31-47, lang:"julia"](code/julia/Tree.jl)
120+
This has not been implemented in your chosen language, so here is the Julia code
121+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
104122
{% sample lang="rs"%}
105-
[import:31-47, lang:"julia"](code/julia/Tree.jl)
123+
This has not been implemented in your chosen language, so here is the Julia code
124+
[import:28-43, lang:"julia"](code/julia/Tree.jl)
106125
{% endmethod %}
107126

108127
<p align="center">
@@ -123,7 +142,7 @@ In code, it looks like this:
123142

124143
{% method %}
125144
{% sample lang="jl" %}
126-
[import:50-61, lang:"julia"](code/julia/Tree.jl)
145+
[import:45-56, lang:"julia"](code/julia/Tree.jl)
127146
{% sample lang="cpp" %}
128147
[import:29-45, lang:"c_cpp"](code/c++/tree_example.cpp)
129148
{% sample lang="cs" %}
@@ -139,7 +158,8 @@ In code, it looks like this:
139158
{% sample lang="py3" %}
140159
[import:31-45, lang:"python"](code/python3/Tree_example.py)
141160
{% sample lang="scratch" %}
142-
[import:49-61, lang:"julia"](code/julia/Tree.jl)
161+
This has not been implemented in your chosen language, so here is the Julia code
162+
[import:45-56, lang:"julia"](code/julia/Tree.jl)
143163
{% sample lang="rs"%}
144164
[import:17-24, lang:"rust"](code/rust/tree.rs)
145165
{% endmethod %}
@@ -154,7 +174,7 @@ And this is exactly what Breadth-First Search (BFS) does! On top of that, it can
154174

155175
{% method %}
156176
{% sample lang="jl" %}
157-
[import:64-75, lang:"julia"](code/julia/Tree.jl)
177+
[import:58-69, lang:"julia"](code/julia/Tree.jl)
158178
{% sample lang="cpp" %}
159179
[import:47-61, lang:"c_cpp"](code/c++/tree_example.cpp)
160180
{% sample lang="cs" %}
@@ -168,7 +188,8 @@ And this is exactly what Breadth-First Search (BFS) does! On top of that, it can
168188
{% sample lang="py3" %}
169189
[import:48-62, lang:"python"](code/python3/Tree_example.py)
170190
{% sample lang="scratch" %}
171-
[import:63-75, lang:"julia"](code/julia/Tree.jl)
191+
This has not been implemented in your chosen language, so here is the Julia code
192+
[import:58-69, lang:"julia"](code/julia/Tree.jl)
172193
{% sample lang="rs"%}
173194
[import:26-34, lang:"rust"](code/rust/tree.rs)
174195
{% endmethod %}

0 commit comments

Comments
 (0)