Chapter 23 - Trees
The nodes in a binary search tree contain _____ objects.
Comparable
A level-order traversal of a binary tree is an example of a depth-first traversal.
False
All leaves in a full binary tree are on the same level.
False
Completely balance binary trees are not necessarily full.
False
Every general tree is an n-ary tree.
False
The path between a tree's root and any other node is not unique.
False
A subtree of a tree is a subtree of the tree's root.
True
All nodes in a balanced binary tree are balanced.
True
An inorder traversal is not well defined for a general tree.
True
Every node in a binary search tree is the root of a binary search tree.
True
In a tree, nodes are arranged in levels that indicate the nodes' hierarchy.
True
In a tree, the root is the only node that has no parent.
True
The height of a tree equals the number of nodes along the longest path between the root and a leaf.
True
A subtree of a node is a tree rooted at
a child of that node
When you classify data into groups and subgroups, you are using a(n) _____ order.
a. hierarchical
An example of a data organization that is hierarchical is a(n)
all of the above
A node in a binary tree whose subtrees differ in height by no more than 1 is known as a(n) _____ node.
balanced
A tree in which each node may have at most two children is called a(n) _____ tree.
binary
A binary tree has at most two children called
both a & b
The nodes at each successive level of a tree are called _____.
children
When a binary tree is full to its next-to-last level and its leaves on the last level are filled from left to right, the tree is said to be
complete
A tree is a set of nodes connected by _____ that indicate the relationships among the nodes.
edges
When a binary tree of height h has all of its leaves at level h and every nonleaf has exactly two children, the tree is said to be
full
A tree in which each node may have an arbitrary number of children is called a(n) _____ tree.
general
The number of levels in a tree is called the
height
A family tree is typically organized into a(n) _____ order.
hierarchical
In a _____ traversal of a binary tree, you visit the root of a binary tree between visiting the nodes o the root's subtrees.
inorder
A node with no children is called a(n) _____.
leaf
In a _____ traversal of a binary tree, you begin at the root and visit nodes one level at a time.
level order
The height of a complete tree that has n nodes is
log2(n+1)
The height of a full tree that has n nodes is
log2(n+1)
A _____ is a complete binary tree such that each node in the tree contains a Comparable object that is greater than or equal to the objects in the node's descendants.
maxheap
A tree in which each node may have no more than n children is called a(n) _____ tree.
n-ary
A tree is a set of _____ connected by edges that indicate the relationships among the nodes.
nodes
A node that has children is called a(n) _____.
nonleaf interior node
A node that has children is a(n) _____.
parent
In a _____ traversal of a binary tree, you visit the root of a binary tree after you visit the root's subtrees.
postorder
In a _____ traversal of a binary tree, you visit the root node before you visit the root's subtrees.
preorder
At the top level of a tree is a single node called the _____.
root
The _____ node is the only node that has no parent.
root
Nodes that are children of the same parent node are called _____.
siblings
Any node and its descendants form a _____ of the original tree.
subtree
A _____ is a set of nodes connected by edges that indicate the relationships among the nodes.
tree
A preorder traversal of a binary tree is an example of a depth-first traversal.
true
List the steps of a postorder traversal of a binary tree.
1. Visit all the nodes in the root's left subtree 2. Visit all the nodes in the root's right subtree 3. visit the root
List the steps of an inorder traversal of a binary tree.
1. Visit all the nodes in the root's left subtree 2. Visit the root 3. Visit all the nodes in the roots right subtree When you classify data into groups and subgroups, you are using a(n) _____ order.
List the steps of a preorder traversal of a binary tree.
1. Visit the root 2. Visit all the nodes in the root's left subtree 3. Visit all the nodes in the root's right subtree
How many nodes are in a full binary tree of height 8?
255, bc 2^8 = 256 and it starts at height 0, subtract 1
How many nodes are in a full binary tree of height 5?
31
What is the height of a complete tree that contains 11 nodes?
4
What is the height of a complete tree that contains 18 nodes?
5