root node: The top node of a tree.
child node: A node connected to a parent node above it in a tree.
parent node: A node with one or more child nodes.
sibling nodes: Nodes that share the same parent.
edge: The connection between two nodes in a tree.
leaf node: A node without child nodes.
branch node: A node with child nodes.
binary tree: A tree data structure where each node can have only two children.
binary search tree: A tree data structure where each node can have only two children, and the tree
stores its nodes in sorted order where every node’s value is greater than its left child’s value and
lower than its right child’s value.
descendants: A node’s children and their children and their children’s children, etc.
HTML: A markup language you can use to create web pages.
XML: A markup language for documents.
document object model: A language- independent interface that models an XML or HTML docu-
ment as a tree.
parse tree: An ordered tree that stores data according to some type of syntax, like the rules for
evaluating an expression.
subtree: A node in a tree, other than the root node, and its descendants.
breadth- first traversal: A method of visiting every node in a tree by visiting each node in it
level by level.
breadth- first search: When you use a breadth- first traversal to perform a search.
depth- first traversal: Visiting all the nodes in a binary tree by going as deep as you can in one
direction before moving to the next sibling.
inverting a binary tree: Swapping all of the nodes in it.
Challenges
1.
Add a method called
has_leaf_nodes
to your binary tree code. The method should return
True
if the tree has no leaf nodes and
False
if it does not.
Do'stlaringiz bilan baham: |