Data Structures and Algorithms with JavaScript by Michael McMillan

Data Structures and Algorithms with JavaScript by Michael McMillan

Author:Michael McMillan
Language: eng
Format: epub, pdf
ISBN: 9781449364939
Publisher: O’Reilly Media, Inc.
Published: 2014-04-08T16:00:00+00:00


Figure 10-1. An organizational chart is a tree structure

Figure 10-2 displays another tree that defines more of the terms we need when discussing trees. The top node of a tree is called the root node. If a node is connected to other nodes below it, the preceding node is called the parent node, and the nodes following it are called child nodes. A node can have zero, one, or more child nodes connected to it. A node without any child nodes is called a leaf node.

Special types of trees, called binary trees, restrict the number of child nodes to no more than two. Binary trees have certain computational properties that make them very efficient for many operations. Binary trees are examined extensively in the sections to follow.

Continuing to examine Figure 10-2, you can see that by following certain edges, you can travel from one node to other nodes that are not directly connected. The series of edges you follow to get from one node to another node is called a path. Paths are depicted in the figure with dashed lines. Visiting all the nodes in a tree in some particular order is known as a tree traversal.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.