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