You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-3Lines changed: 15 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -178,12 +178,24 @@ Depth First Search (DFS) uses a `stack` for storing the nodes that it is visitin
178
178
179
179
Breadth First Search (BFS) uses a `queue` for storing the nodes that it is visiting.
180
180
181
-
### Trees
181
+
### Tree
182
182
183
183
A tree has hierarchical data and it has nodes.
184
184
185
-
**root**: top node of tree is called root and has no parent.
186
-
**node**: every node has parent ( except root ) and 0 or more children's.
185
+

186
+
187
+
-**Root**: top node of tree is called root and has no parent and has no incoming edges.
188
+
-**Node**: every node has parent ( except root ) and 0 or more children's.
189
+
-**Edge**: used to connect two nodes.
190
+
-**Path**: A path is an ordered list of nodes that are connected by edges.
191
+
-**Leaf**: A leaf node is a node that has no children.
192
+
-**Height of the tree**: The height of a tree is the number of edges on the longest path between the root and a leaf.
193
+
-**The level of node**: The level of a node is the number of edges on the path from the root node to that node.
194
+
-**Children**: Nodes that have incoming edges from the same node to be said to be the children of that node.
195
+
-**Parent**: Node is a parent of all the child nodes that are linked by outgoing edges. - **Sibling**: Nodes in the tree that are children of the same parent are called siblings.
196
+
-**Ancestor**: A node reachable by repeated moving from child to parent.
0 commit comments