Deck 19: Binary Trees
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/38
Play
Full screen (f)
Deck 19: Binary Trees
1
The number of nodes in a binary tree is the number of nodes in its left subtree plus the number of nodes in its right subtree.
False
2
A strong reason to use a binary search tree is
A) to expedite the process of searching large sets of information.
B) aesthetics and program design.
C) to enhance code readability.
D) it is more flexible than the unary search tree.
E) None of the above
A) to expedite the process of searching large sets of information.
B) aesthetics and program design.
C) to enhance code readability.
D) it is more flexible than the unary search tree.
E) None of the above
A
3
A node that has no children is a
A) root node.
B) head node.
C) leaf node.
D) pure binary node.
E) None of the above
A) root node.
B) head node.
C) leaf node.
D) pure binary node.
E) None of the above
C
4
A binary tree node with no parent is called the
A) head pointer.
B) binary node.
C) root node.
D) pointer node.
E) None of the above
A) head pointer.
B) binary node.
C) root node.
D) pointer node.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
5
The height of a binary tree describes how many levels there are in the tree.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
6
A child node that has no parent is
A) a leaf node.
B) an orphan node.
C) a rootless node.
D) A or C
E) None of the above
A) a leaf node.
B) an orphan node.
C) a rootless node.
D) A or C
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
7
Output will be the same if you use inorder, postorder, or preorder traversals to print the values stored in a binary tree.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
8
When a binary tree is used to facilitate a search, it is referred to as a
A) binary queue.
B) binary ordered deque.
C) binary search tree.
D) sort algorithm.
E) None of the above
A) binary queue.
B) binary ordered deque.
C) binary search tree.
D) sort algorithm.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
9
Values are commonly stored in a binary search tree so that a node's ________ child holds data that is less than the ________ data, while the node's data is less than the data in the other child.
A) right, node's
B) left, node's
C) right, left child's
D) left, right child's
E) None of the above
A) right, node's
B) left, node's
C) right, left child's
D) left, right child's
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
10
A subtree is the collection of some node, together with all its descendants.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
11
A program keeps track of a binary tree using a pointer to
A) one of its leaves.
B) its root node.
C) the node in the tree holding the biggest value.
D) the node in the tree holding the smallest value.
E) None of the above
A) one of its leaves.
B) its root node.
C) the node in the tree holding the biggest value.
D) the node in the tree holding the smallest value.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
12
The ________ in a binary tree is analogous to the head pointer in a linked list.
A) root pointer
B) leaf pointer
C) null pointer
D) binary pointer
E) None of the above
A) root pointer
B) leaf pointer
C) null pointer
D) binary pointer
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
13
When an application begins searching a binary search tree, it starts at
A) the outermost leaf node.
B) the middle node, halfway between the root and the longest branch.
C) the root node.
D) the rightmost child of the root node.
E) None of the above
A) the outermost leaf node.
B) the middle node, halfway between the root and the longest branch.
C) the root node.
D) the rightmost child of the root node.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
14
Deleting a node from a binary search tree node
A) is easiest when the node is the root.
B) is hardest when the node is a leaf.
C) is hardest when the node has one child.
D) is hardest when the node has two children.
E) None of the above
A) is easiest when the node is the root.
B) is hardest when the node is a leaf.
C) is hardest when the node has one child.
D) is hardest when the node has two children.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
15
Visiting all nodes of a binary tree in some methodical fashion is known as
A) climbing the tree.
B) traversing the tree.
C) walking through tree.
D) branching out along the tree.
E) None of the above
A) climbing the tree.
B) traversing the tree.
C) walking through tree.
D) branching out along the tree.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
16
Binary search trees are commonly used
A) with arrays of integers.
B) in database applications.
C) in linear data communication processes.
D) A and C
E) None of the above
A) with arrays of integers.
B) in database applications.
C) in linear data communication processes.
D) A and C
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
17
The inorder method of traversing a binary tree involves traversing the left subtree, processing the data in the root, and then traversing the right subtree.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
18
Binary search trees may be implemented as templates, but any data types used with them should support the ________ operator.
A) <
B) >
C) ==
D) All of the above
E) None of the above
A) <
B) >
C) ==
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
19
Binary tree are called "trees" because they resemble an upside-down tree.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
20
The main difference between a binary tree and a linked list is that
A) a linked list can be empty, but a binary tree cannot.
B) a binary tree can be empty, but a linked list cannot.
C) nodes in a binary tree have two successors instead of one.
D) recursion is useful on binary trees, but not on linked lists.
E) None of the above
A) a linked list can be empty, but a binary tree cannot.
B) a binary tree can be empty, but a linked list cannot.
C) nodes in a binary tree have two successors instead of one.
D) recursion is useful on binary trees, but not on linked lists.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
21
A tree with a height of three must have
A) six nodes.
B) one root and three nodes with two children each.
C) three levels.
D) three subtrees.
E) None of the above
A) six nodes.
B) one root and three nodes with two children each.
C) three levels.
D) three subtrees.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
22
Deleting a leaf node from a binary search tree is not difficult. Deleting a non-leaf node requires several steps.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
23
Inorder, preorder, and postorder traversals can be accomplished using
A) recursion.
B) no pointers.
C) no arguments.
D) no parameters.
E) None of the above.
A) recursion.
B) no pointers.
C) no arguments.
D) no parameters.
E) None of the above.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
24
There exists a binary tree with a hundred nodes, but only one leaf.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
25
The smallest number of levels that a binary tree with three nodes can have is two.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
26
In a binary search tree where all the stored values are different, the node holding the largest value cannot have two children.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
27
In certain types of binary trees, the number of leaves can be greater than the number of nodes.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
28
Binary trees are commonly used to organize key values that index database records.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
29
In a binary search tree, all nodes to the right of a node hold values greater than the node's value.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
30
Every node in a binary tree can have pointers to
A) its left and right child.
B) its left and right parent.
C) binary nodes.
D) its end nodes.
E) None of the above
A) its left and right child.
B) its left and right parent.
C) binary nodes.
D) its end nodes.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
31
A binary tree can be created using a structure containing a data value and
A) a pointer to the first child node.
B) a pointer to the last child node.
C) two pointers, one for the left child and one for the right child.
D) two data nodes.
E) None of the above
A) a pointer to the first child node.
B) a pointer to the last child node.
C) two pointers, one for the left child and one for the right child.
D) two data nodes.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
32
One method of traversing a binary tree is
A) inorder traversal.
B) preorder traversal.
C) postorder traversal.
D) All of the above
E) None of the above
A) inorder traversal.
B) preorder traversal.
C) postorder traversal.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
33
The shape of a binary search tree is
A) always triangular.
B) always balanced.
C) determined by the programmer.
D) determined by the order in which values are inserted.
E) None of the above
A) always triangular.
B) always balanced.
C) determined by the programmer.
D) determined by the order in which values are inserted.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
34
Implementing a binary tree in a class requires a structure for representing the nodes of the binary tree, as well as a pointer to the structure as a class member. This pointer will be set to
A) the leftmost child node.
B) the first leaf node.
C) the root of the tree.
D) the deepest leaf node.
E) None of the above
A) the leftmost child node.
B) the first leaf node.
C) the root of the tree.
D) the deepest leaf node.
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
35
The width of a tree is the largest number of nodes at the same level.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
36
An operation that can be performed on a binary search tree is
A) insertion of new value.
B) searching the tree for the occurrence of a given value.
C) removing a value stored in the tree.
D) All of the above
E) None of the above
A) insertion of new value.
B) searching the tree for the occurrence of a given value.
C) removing a value stored in the tree.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
37
The preorder method of traversing a binary tree involves processing the root node's data, traversing the left subtree, and then traversing the right subtree.
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck
38
If a node has no successor, the corresponding pointer is set to
A) the root of the tree.
B) point to its parent node.
C) a leaf.
D) NULL .
E) None of the above
A) the root of the tree.
B) point to its parent node.
C) a leaf.
D) NULL .
E) None of the above
Unlock Deck
Unlock for access to all 38 flashcards in this deck.
Unlock Deck
k this deck