Skip to content

Commit 69571a8

Browse files
committed
updating tree_traversal.md
1 parent e8bac04 commit 69571a8

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

chapters/tree_traversal/tree_traversal.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Tree Traversal
1+
# Tree Traversal
22

33
Trees are naturally recursive data structures, and because of this, we cannot access their elements like we might access the elements of a vector or array. Instead, we need to use more interesting methods to work through each element. This is often called *Tree Traversal*, and there are many different ways to do this. For now, we will restrict the discussion to two common and related methods of tree traversal: *Depth-First* and *Breadth-First Search*. Note that trees vary greatly in shape and size depending on how they are used; however, they are composed primarily of nodes that house other, children nodes, like so:
44

@@ -10,7 +10,7 @@ Trees are naturally recursive data structures, and because of this, we cannot ac
1010
{% sample lang="cs" %}
1111
[import:11-15, lang:"csharp"](code/cs/TreeMdAdditional/TreeMdAdditional.cs)
1212
{% sample lang="c" %}
13-
[import:5-10, lang:"c_cpp"](code/c/tree_traversal.c)
13+
[import:5-9, lang:"c_cpp"](code/c/tree_traversal.c)
1414
{% sample lang="js" %}
1515
This has not been implemented in your chosen language, so here is the Julia code
1616
[import:3-7, lang:"julia"](code/julia/Tree.jl)
@@ -35,7 +35,7 @@ Because of this, the most straightforward way to traverse the tree might be recu
3535
{% sample lang="cs" %}
3636
[import:48-57, lang:"csharp"](code/cs/TreeMdAdditional/TreeMdAdditional.cs)
3737
{% sample lang="c" %}
38-
[import:77-86, lang:"c_cpp"](code/c/tree_traversal.c)
38+
[import:78-87, lang:"c_cpp"](code/c/tree_traversal.c)
3939
{% sample lang="js" %}
4040
[import:15-23, lang:"javascript"](code/javascript/Tree_example.js)
4141
{% sample lang="py2" %}
@@ -70,8 +70,7 @@ This has not been implemented in your chosen language, so here is the Julia code
7070
{% sample lang="cs" %}
7171
[import:75-84, lang:"csharp"](code/cs/TreeMdAdditional/TreeMdAdditional.cs)
7272
{% sample lang="c" %}
73-
This has not been implemented in your chosen language, so here is the Julia code
74-
[import:18-26, lang:"julia"](code/julia/Tree.jl)
73+
[import:89-95, lang:"c_cpp"](code/c/tree_traversal.c)
7574
{% sample lang="js" %}
7675
This has not been implemented in your chosen language, so here is the Julia code
7776
[import:18-26, lang:"julia"](code/julia/Tree.jl)
@@ -104,8 +103,7 @@ This has not been implemented in your chosen language, so here is the Julia code
104103
{% sample lang="cs" %}
105104
[import:86-104, lang:"csharp"](code/cs/TreeMdAdditional/TreeMdAdditional.cs)
106105
{% sample lang="c" %}
107-
This has not been implemented in your chosen language, so here is the Julia code
108-
[import:28-43, lang:"julia"](code/julia/Tree.jl)
106+
[import:97-110, lang:"c_cpp"](code/c/tree_traversal.c)
109107
{% sample lang="js" %}
110108
This has not been implemented in your chosen language, so here is the Julia code
111109
[import:28-43, lang:"julia"](code/julia/Tree.jl)
@@ -149,7 +147,7 @@ In code, it looks like this:
149147
{% sample lang="c" %}
150148
[import:20-33, lang:"c_cpp"](code/c/tree_traversal.c)
151149
[import:35-47, lang:"c_cpp"](code/c/tree_traversal.c)
152-
[import:88-106, lang:"c_cpp"](code/c/tree_traversal.c)
150+
[import:112-130, lang:"c_cpp"](code/c/tree_traversal.c)
153151
{% sample lang="js" %}
154152
[import:25-40, lang:"javascript"](code/javascript/Tree_example.js)
155153
{% sample lang="py2" %}
@@ -179,7 +177,7 @@ And this is exactly what Breadth-First Search (BFS) does! On top of that, it can
179177
{% sample lang="cs" %}
180178
[import:54-70, lang:"csharp"](code/cs/Tree/Tree.cs)
181179
{% sample lang="c" %}
182-
[import:108-126, lang:"c_cpp"](code/c/tree_traversal.c)
180+
[import:132-150, lang:"c_cpp"](code/c/tree_traversal.c)
183181
{% sample lang="js" %}
184182
[import:42-57, lang:"javascript"](code/javascript/Tree_example.js)
185183
{% sample lang="py2" %}

0 commit comments

Comments
 (0)