Tree Nodes Flashcards
A leaf node is a node…
that has no children
True or False.
Any node with a child is an internal node
True
How many children can a node have in a binary tree?
It can have up to 2 children
What is the depth of a root node?
0
If a tree has just one node what is the depth?
0
A link from a node to a child is called a…
edge
A binary tree is full if…
Every node contains 0 or 2 children
A binary tree is perfect if…
All internal nodes have 2 children and all leaf nodes are at the same level
A binary tree is complete if…
All levels, except the last level, contain all possible nodes and all nodes in the last level are as far left possible
What is a binary search tree?
Orders the left child of the less than or equal to the parent node
Orders the right child greater than or equal to the parent node
Where does searching begin in a tree?
It begins at the root
Example: If you are searching for 145 in a tree and the root of the node is 300, where will the search begin?
145< 300, so the search will begin with the left child
If a match is not found what is returned?
Null
Insert as a node as a left child involves…
If the new node is less than the current node
The current nodes left child is null
Insert a node as a right child involves…
If the new node’s key is greater than or equal to the current node
The current node right child is null